# Code Manifesto Data for:
# "Reconciling National and Supranational Identities:
# Civilizationism in European Far-Right Discourse"

# Joseph Cerrone

# Perspectives on Politics

# Load Packages-----
library(tidyverse)
library(manifestoR)
library(quanteda)
library(stopwords)
library(lubridate)
library(stringi)


# Access Manifesto Project-----
# Add your own File Path and Manifesto API Key
mp_setapikey("~/FILE PATH/MANIFESTO API KEY.txt")
mp_use_corpus_version("2020-2")
col_keep <- c("party", "date", "language", "manifesto_id", "title", "annotations")


# Dictionaries 1-----
dict_bulgarian <- dictionary(list(
  civ_gen = c("\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438*")))
dict_croatian <- dictionary(list(
  civ_gen = c("civilizacij*")))
dict_czech <- dictionary(list(
  civ_gen = c("civiliza*")))
dict_danish <- dictionary(list(
  civ_gen = c("civilisation*")))
dict_dutch <- dictionary(list(
  civ_gen = c("beschaving*")))
dict_english <- dictionary(list(
  civ_gen = c("civiliz*", "civilis*")))
dict_estonian <- dictionary(list(
  civ_gen = c("tsivilisatsioon*")))
dict_finnish <- dictionary(list(
  civ_gen = c("sivilisaatio*")))
dict_french <- dictionary(list(
  civ_gen = c("civilis*")))
dict_german <- dictionary(list(
  civ_gen = c("zivilisa*", "zivilisi*", "kultur*")))
dict_greek <- dictionary(list(
  civ_gen = c("\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3*")))
dict_hungarian <- dictionary(list(
  civ_gen = c("civilizáció*")))
dict_italian <- dictionary(list(
  civ_gen = c("civilizz*", "civilt*")))
dict_latvian <- dictionary(list(
  civ_gen = c("civilizācij*")))
dict_lithuanian <- dictionary(list(
  civ_gen = c("civilizaci*")))
dict_polish <- dictionary(list(
  civ_gen = c("cywilizac*")))
dict_portuguese <- dictionary(list(
  civ_gen = c("civilizaç*", "civilizacion*")))
dict_romanian <- dictionary(list(
  civ_gen = c("civiliz*")))
dict_slovak <- dictionary(list(
  civ_gen = c("civilizác*", "civilizačn*")))
dict_slovenian <- dictionary(list(
  civ_gen = c("civilizacij*")))
dict_spanish <- dictionary(list(
  civ_gen = c("civiliz*")))
dict_swedish <- dictionary(list(
  civ_gen = c("civilisation*")))


# Import Manifesto Data-----
# Belgium
belgium_dutch_manifestos <- mp_metadata(countryname == "Belgium" & edate > as.Date("1990-01-01")) %>%
  filter(language == "dutch") %>%
  subset(select = col_keep)
belgium_dutch_manifestos$state <- "Belgium"
belgium_dutch_manifestos$state_ab <- "BE"
belgium_dutch_manifestos$far_right <- 0
belgium_dutch_manifestos$eurosceptic <- 0
belgium_dutch_manifestos$date <- as.Date(paste0(belgium_dutch_manifestos$date, "01"), format = "%Y%m%d")
belgium_dutch_manifestos$year <- year(belgium_dutch_manifestos$date)
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21112] <- "ECO"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21112] <- "Live Differently/Green!"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party ==	21221] <- "SOC"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21221] <- "Socialist Party/Different Spirit"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21230] <- "COM"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21230] <- "Workers' Party of Belgium"
belgium_dutch_manifestos$eurosceptic[belgium_dutch_manifestos$party == 21230] <- 1
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21321] <- "SOC"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21321] <- "Flemish Socialist Party/Socialist Party Different"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21330] <- "SOC"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21330] <- "Social, Progressive, International, Regionalist, Integrally Democratic and Forward-Looking"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21421] <- "LIB"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21421] <- "Flemish Liberals and Democrats"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21430] <- "LIB"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21430] <- "List Dedecker"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21521] <- "CHR"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21521] <- "Christian People's Party/Christian Democratic and Flemish"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21913] <- "ETH"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21913] <- "Peoples' Union"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21914] <- "NAT"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21914] <- "Flemish Bloc"
belgium_dutch_manifestos$far_right[belgium_dutch_manifestos$party == 21914] <- 1
belgium_dutch_manifestos$eurosceptic[belgium_dutch_manifestos$party == 21914] <- 1
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21915] <- "ETH"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21915] <- "People's Union-Complete Democracy for the 21st Century"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 21916] <- "ETH"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 21916] <- "New Flemish Alliance"
belgium_dutch_manifestos$parfam_cmp[belgium_dutch_manifestos$party == 	21917] <- "NAT"
belgium_dutch_manifestos$parname[belgium_dutch_manifestos$party == 	21917] <- "Flemish Interest"
belgium_dutch_manifestos$far_right[belgium_dutch_manifestos$party == 21917] <- 1
belgium_dutch_manifestos$eurosceptic[belgium_dutch_manifestos$party == 21917] <- 1
belgium_dutch_manifestos$far_right <- as.factor(belgium_dutch_manifestos$far_right)
belgium_dutch_manifestos$eurosceptic <- as.factor(belgium_dutch_manifestos$eurosceptic)

belgium_french_manifestos <- mp_metadata(countryname == "Belgium" & edate > as.Date("1990-01-01")) %>%
  filter(language == "french") %>%
  subset(select = col_keep)
belgium_french_manifestos$state <- "Belgium"
belgium_french_manifestos$state_ab <- "BE"
belgium_french_manifestos$far_right <- 0
belgium_french_manifestos$eurosceptic <- 0
belgium_french_manifestos$date <- as.Date(paste0(belgium_french_manifestos$date, "01"), format = "%Y%m%d")
belgium_french_manifestos$year <- year(belgium_french_manifestos$date)
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21111] <- "ECO"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21111] <- "Ecologists"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 	21322] <- "SOC"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 	21322] <- "Francophone Socialist Party"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21422] <- "LIB"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21422] <- "Liberal Reformation Party"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21423] <- "LIB"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21423] <- "Liberal Reformation Party-Francophone Democratic Front"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21425] <- "LIB"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21425] <- "Liberal Reformation Party-Francophone Democratic Front-Citizens' Movement for Change"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21426] <- "LIB"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21426] <- "Reform Movement"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21522] <- "CHR"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21522] <- "Christian Social Party/Humanist Democratic Centre"
belgium_french_manifestos$parfam_cmp[belgium_french_manifestos$party == 21912] <- "ETH"
belgium_french_manifestos$parname[belgium_french_manifestos$party == 21912] <- "Francophone Democratic Front of Francophones"
belgium_french_manifestos$far_right <- as.factor(belgium_french_manifestos$far_right)
belgium_french_manifestos$eurosceptic <- as.factor(belgium_french_manifestos$eurosceptic)

# France
france_manifestos <- mp_metadata(countryname == "France" & edate > as.Date("1990-01-01")) %>%
  filter(language == "french") %>%
  subset(select = col_keep)
france_manifestos$state <- "France"
france_manifestos$state_ab <- "FR"
france_manifestos$far_right <- 0
france_manifestos$eurosceptic <- 0
france_manifestos$date <- as.Date(paste0(france_manifestos$date, "01"), format = "%Y%m%d")
france_manifestos$year <- year(france_manifestos$date)
france_manifestos$parfam_cmp[france_manifestos$party == 31021] <- "COM"
france_manifestos$parname[france_manifestos$party == 31021] <- "Left Front"
france_manifestos$eurosceptic[france_manifestos$party == 31021] <- 1
france_manifestos$parfam_cmp[france_manifestos$party == 31110] <- "ECO"
france_manifestos$parname[france_manifestos$party == 31110] <- "Greens/Europe Ecology"
france_manifestos$parfam_cmp[france_manifestos$party == 	31111] <- "ECO"
france_manifestos$parname[france_manifestos$party == 	31111] <- "Ecology Generation"
france_manifestos$parfam_cmp[france_manifestos$party == 31220] <- "COM"
france_manifestos$parname[france_manifestos$party == 31220] <- "French Communist Party"
france_manifestos$eurosceptic[france_manifestos$party == 31220] <- 1
france_manifestos$parfam_cmp[france_manifestos$party == 31230] <- "COM"
france_manifestos$parname[france_manifestos$party == 31230] <- "Left Radical Party"
france_manifestos$parfam_cmp[france_manifestos$party == 31240] <- "COM"
france_manifestos$parname[france_manifestos$party == 31240] <- "Indomitable France"
france_manifestos$eurosceptic[france_manifestos$party == 31240] <- 1
france_manifestos$parfam_cmp[france_manifestos$party == 31320] <- "SOC"
france_manifestos$parname[france_manifestos$party == 31320] <- "Socialist Party"
france_manifestos$parfam_cmp[france_manifestos$party == 31421] <- "LIB"
france_manifestos$parname[france_manifestos$party == 31421] <- "Radical Party"
france_manifestos$parfam_cmp[france_manifestos$party == 31425] <- "LIB"
france_manifestos$parname[france_manifestos$party == 31425] <- "Republic Onwards!"
france_manifestos$parfam_cmp[france_manifestos$party == 31430] <- "LIB"
france_manifestos$parname[france_manifestos$party == 31430] <- "Union of Democrats and Independents"
france_manifestos$parfam_cmp[france_manifestos$party == 31624] <- "CON"
france_manifestos$parname[france_manifestos$party == 31624] <- "Union for French Democracy/Democratic Movement"
france_manifestos$parfam_cmp[france_manifestos$party == 31625] <- "CON"
france_manifestos$parname[france_manifestos$party == 31625] <- "Rally for the Republic"
france_manifestos$parfam_cmp[france_manifestos$party == 31626] <- "CON"
france_manifestos$parname[france_manifestos$party == 31626] <- "UMP/Republicans"
france_manifestos$parfam_cmp[france_manifestos$party == 31630] <- "CON"
france_manifestos$parname[france_manifestos$party == 31630] <- "New Centre"
france_manifestos$parfam_cmp[france_manifestos$party == 31631] <- "CON"
france_manifestos$parname[france_manifestos$party == 31631] <- "Centrist Alliance"
france_manifestos$parfam_cmp[france_manifestos$party == 31720] <- "NAT"
france_manifestos$parname[france_manifestos$party == 31720] <- "National Front"
france_manifestos$far_right[france_manifestos$party == 31720] <- 1
france_manifestos$eurosceptic[france_manifestos$party == 31720] <- 1
france_manifestos$far_right <- as.factor(france_manifestos$far_right)
france_manifestos$eurosceptic <- as.factor(france_manifestos$eurosceptic)

# Germany
germany_manifestos <- mp_metadata(countryname == "Germany" & edate > as.Date("1990-01-01")) %>%
  filter(language == "german") %>%
  subset(select = col_keep)
germany_manifestos$state <- "Germany"
germany_manifestos$state_ab <- "DE"
germany_manifestos$far_right <- 0
germany_manifestos$eurosceptic <- 0
germany_manifestos$date <- as.Date(paste0(germany_manifestos$date, "01"), format = "%Y%m%d")
germany_manifestos$year <- year(germany_manifestos$date)
germany_manifestos$parfam_cmp[germany_manifestos$party == 41112 |
                                germany_manifestos$party == 41113] <- "ECO"
germany_manifestos$parname[germany_manifestos$party == 41112 |
                             germany_manifestos$party == 41113] <- "Alliance '90/Greens"
germany_manifestos$parfam_cmp[germany_manifestos$party == 41221 |
                                germany_manifestos$party == 41222 |
                                germany_manifestos$party == 41223] <- "COM"
germany_manifestos$parname[germany_manifestos$party == 41221 |
                             germany_manifestos$party == 41222 | 
                             germany_manifestos$party == 41223] <- "The Left/Party of Democratic Socialism"
germany_manifestos$eurosceptic[germany_manifestos$party == 41221 |
                                 germany_manifestos$party == 41222 | 
                                 germany_manifestos$party == 41223] <- 1
germany_manifestos$parfam_cmp[germany_manifestos$party == 41320] <- "SOC"
germany_manifestos$parname[germany_manifestos$party ==	41320] <- "Social Democratic Party"
germany_manifestos$parfam_cmp[germany_manifestos$party == 41420] <- "LIB"
germany_manifestos$parname[germany_manifestos$party == 41420] <- "Free Democratic Party"
germany_manifestos$parfam_cmp[germany_manifestos$party == 41521] <- "CHR"
germany_manifestos$parname[germany_manifestos$party == 41521] <- "Christian Democratic Union"
germany_manifestos$parfam_cmp[germany_manifestos$party == 41952] <- "SIP"
germany_manifestos$parname[germany_manifestos$party == 41952] <- "Pirates"
germany_manifestos$parfam_cmp[germany_manifestos$party == 41953] <- "NAT"
germany_manifestos$parname[germany_manifestos$party == 41953] <- "Alternative for Germany"
germany_manifestos$far_right[germany_manifestos$party == 41953] <- 1
germany_manifestos$eurosceptic[germany_manifestos$party == 41953] <- 1
germany_manifestos$far_right <- as.factor(germany_manifestos$far_right)
germany_manifestos$eurosceptic <- as.factor(germany_manifestos$eurosceptic)

# Italy
italy_manifestos <- mp_metadata(countryname == "Italy" & edate > as.Date("1990-01-01")) %>%
  filter(language == "italian") %>%
  subset(select = col_keep)
italy_manifestos$state <- "Italy"
italy_manifestos$state_ab <- "IT"
italy_manifestos$far_right <- 0
italy_manifestos$eurosceptic <- 0
italy_manifestos$date <- as.Date(paste0(italy_manifestos$date, "01"), format = "%Y%m%d")
italy_manifestos$year <- year(italy_manifestos$date)
italy_manifestos$parfam_cmp[italy_manifestos$party == 32021] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32021] <- "Civil Revolution"
italy_manifestos$eurosceptic[italy_manifestos$party == 32021] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32022] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32022] <- "Italy Europe Together"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32031] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32031] <- "Free and Equal"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32051] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32051] <- "Popular Civic List"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32055] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32055] <- "Us With Italy"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32061] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32061] <- "People of Freedom"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32090] <- "ETH"
italy_manifestos$parname[italy_manifestos$party == 32090] <- "Coalition of South Tyrolean People's Party and Trentino Tyrolean Autonomist Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32110] <- "ECO"
italy_manifestos$parname[italy_manifestos$party == 32110] <- "Green Federation"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32111] <- "ECO"
italy_manifestos$parname[italy_manifestos$party == 32111] <- "Sunflower"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32212] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32212] <- "Communist Refoundation Party"
italy_manifestos$eurosceptic[italy_manifestos$party == 32212] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32213] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32213] <- "Party of Italian Communists"
italy_manifestos$eurosceptic[italy_manifestos$party == 332213] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32220] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32220] <- "Democratic Party of the Left"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32230] <- "COM"
italy_manifestos$parname[italy_manifestos$party == 32230] <- "Left Ecology Freedom"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32310] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32310] <- "Pannella-Riformatori-Sgarbi List"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32320] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32320] <- "Italian Socialist Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32321] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32321] <- "Italian Renewal"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32330] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32330] <- "Italian Democratic Socialist Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32410] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32410] <- "Italian Republican Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32420] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32420] <- "Italian Liberal Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32421] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32421] <- "Daisy-Democracy Is Freedom"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32440] <- "SOC"
italy_manifestos$parname[italy_manifestos$party == 32440] <- "Democratic Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32450] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32450] <- "Democratic Centre"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32451] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32451] <- "More Europe"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32460] <- "LIB"
italy_manifestos$parname[italy_manifestos$party == 32460] <- "Civic Choice"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32520] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32520] <- "Christian Democrats/Italian Popular Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32521] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32521] <- "Christian Democratic Centre"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32522] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32522] <- "White Flower"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32528] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32528] <- "Pact for Italy"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32529] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32529] <- "Democratic Alliance"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32530] <- "CHR"
italy_manifestos$parname[italy_manifestos$party == 32530] <- "Union of the Center"
italy_manifestos$parfam_cmp[italy_manifestos$party ==	32610] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32610] <- "Forza Italia"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32611] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32611] <- "New Italian Socialist Party"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32629] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32629] <- "House of Freedom"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32630] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32630] <- "Brothers of Italy"
italy_manifestos$far_right[italy_manifestos$party == 32630] <- 1
italy_manifestos$eurosceptic[italy_manifestos$party == 32630] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32640] <- "CON"
italy_manifestos$parname[italy_manifestos$party == 32640] <- "Labour and Freedom List"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32710] <- "NAT"
italy_manifestos$parname[italy_manifestos$party == 32710] <- "Italian Social Movement/National Alliance"
italy_manifestos$far_right[italy_manifestos$party == 32710] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32720] <- "NAT"
italy_manifestos$parname[italy_manifestos$party == 32720] <- "Northern League/League"
italy_manifestos$far_right[italy_manifestos$party == 32720] <- 1
italy_manifestos$eurosceptic[italy_manifestos$party == 32720] <- 1
italy_manifestos$parfam_cmp[italy_manifestos$party == 32901] <- "SIP"
italy_manifestos$parname[italy_manifestos$party == 32901] <- "European Democracy"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32902] <- "SIP"
italy_manifestos$parname[italy_manifestos$party == 32902] <- "List Di Pietro-Italy of Values"
italy_manifestos$parfam_cmp[italy_manifestos$party == 	32906] <- "ETH"
italy_manifestos$parname[italy_manifestos$party == 	32906] <- "Autonomy Progress Federalism Aosta Valley"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32951] <- "SIP"
italy_manifestos$parname[italy_manifestos$party == 32951] <- "The Network/Movement for Democracy"
italy_manifestos$parfam_cmp[italy_manifestos$party == 32956] <- "SIP"
italy_manifestos$parname[italy_manifestos$party == 32956] <- "Five Star Movement"
italy_manifestos$eurosceptic[italy_manifestos$party == 32956] <- 1
italy_manifestos$far_right <- as.factor(italy_manifestos$far_right)
italy_manifestos$eurosceptic <- as.factor(italy_manifestos$eurosceptic)

# Luxembourg
luxembourg_french_manifestos <- mp_metadata(countryname == "Luxembourg" & edate > as.Date("1990-01-01")) %>%
  filter(language == "french") %>%
  subset(select = col_keep)
luxembourg_french_manifestos$state <- "Luxembourg"
luxembourg_french_manifestos$state_ab <- "LU"
luxembourg_french_manifestos$far_right <- 0
luxembourg_french_manifestos$eurosceptic <- 0
luxembourg_french_manifestos$date <- as.Date(paste0(luxembourg_french_manifestos$date, "01"), format = "%Y%m%d")
luxembourg_french_manifestos$year <- year(luxembourg_french_manifestos$date)
luxembourg_french_manifestos$parfam_cmp[luxembourg_french_manifestos$party == 23113] <- "ECO"
luxembourg_french_manifestos$parname[luxembourg_french_manifestos$party == 23113] <- "The Greens"
luxembourg_french_manifestos$parfam_cmp[luxembourg_french_manifestos$party == 23230] <- "COM"
luxembourg_french_manifestos$parname[luxembourg_french_manifestos$party == 23230] <- "The Left"
luxembourg_french_manifestos$eurosceptic[luxembourg_french_manifestos$party == 23230] <- 1
luxembourg_french_manifestos$parfam_cmp[luxembourg_french_manifestos$party == 23420] <- "LIB"
luxembourg_french_manifestos$parname[luxembourg_french_manifestos$party == 23420] <- "Democratic Party"
luxembourg_french_manifestos$parfam_cmp[luxembourg_french_manifestos$party == 23520] <- "CHR"
luxembourg_french_manifestos$parname[luxembourg_french_manifestos$party == 23520] <- "Christian Social People's Party"
luxembourg_french_manifestos$far_right <- as.factor(luxembourg_french_manifestos$far_right)
luxembourg_french_manifestos$eurosceptic <- as.factor(luxembourg_french_manifestos$eurosceptic)

luxembourg_german_manifestos <- mp_metadata(countryname == "Luxembourg" & edate > as.Date("1990-01-01")) %>%
  filter(language == "german") %>%
  subset(select = col_keep)
luxembourg_german_manifestos$state <- "Luxembourg"
luxembourg_german_manifestos$state_ab <- "LU"
luxembourg_german_manifestos$far_right <- 0
luxembourg_german_manifestos$eurosceptic <- 0
luxembourg_german_manifestos$date <- as.Date(paste0(luxembourg_german_manifestos$date, "01"), format = "%Y%m%d")
luxembourg_german_manifestos$year <- year(luxembourg_german_manifestos$date)
luxembourg_german_manifestos$parfam_cmp[luxembourg_german_manifestos$party == 23113] <- "ECO"
luxembourg_german_manifestos$parname[luxembourg_german_manifestos$party == 23113] <- "The Greens"
luxembourg_german_manifestos$parfam_cmp[luxembourg_german_manifestos$party == 23320] <- "SOC"
luxembourg_german_manifestos$parname[luxembourg_german_manifestos$party == 23320] <- "Socialist Workers' Party of Luxembourg"
luxembourg_german_manifestos$parfam_cmp[luxembourg_german_manifestos$party == 23420] <- "LIB"
luxembourg_german_manifestos$parname[luxembourg_german_manifestos$party == 23420] <- "Democratic Party"
luxembourg_german_manifestos$parfam_cmp[luxembourg_german_manifestos$party == 23520] <- "CHR"
luxembourg_german_manifestos$parname[luxembourg_german_manifestos$party == 23520] <- "Christian Social People's Party"
luxembourg_german_manifestos$parfam_cmp[luxembourg_german_manifestos$party == 23951] <- "SIP"
luxembourg_german_manifestos$parname[luxembourg_german_manifestos$party == 23951] <- "Alternative Democratic Reform Party"
luxembourg_german_manifestos$eurosceptic[luxembourg_german_manifestos$party == 23951] <- 1
luxembourg_german_manifestos$far_right <- as.factor(luxembourg_german_manifestos$far_right)
luxembourg_german_manifestos$eurosceptic <- as.factor(luxembourg_german_manifestos$eurosceptic)

# Netherlands
netherlands_manifestos <- mp_metadata(countryname == "Netherlands" & edate > as.Date("1990-01-01")) %>%
  filter(language == "dutch") %>%
  subset(select = col_keep)
netherlands_manifestos$state <- "Netherlands"
netherlands_manifestos$state_ab <- "NL"
netherlands_manifestos$far_right <- 0
netherlands_manifestos$eurosceptic <- 0
netherlands_manifestos$date <- as.Date(paste0(netherlands_manifestos$date, "01"), format = "%Y%m%d")
netherlands_manifestos$year <- year(netherlands_manifestos$date)
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22110] <- "ECO"
netherlands_manifestos$parname[netherlands_manifestos$party == 22110] <- "Green Left"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22220] <- "COM"
netherlands_manifestos$parname[netherlands_manifestos$party == 22220] <- "Socialist Party"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22220] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22320] <- "SOC"
netherlands_manifestos$parname[netherlands_manifestos$party == 22320] <- "Labour Party"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22321] <- "SOC"
netherlands_manifestos$parname[netherlands_manifestos$party == 22321] <- "DENK"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22330] <- "LIB"
netherlands_manifestos$parname[netherlands_manifestos$party == 22330] <- "Democrats'66"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22420] <- "LIB"
netherlands_manifestos$parname[netherlands_manifestos$party == 22420] <- "People's Party for Freedom and Democracy"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22521] <- "CHR"
netherlands_manifestos$parname[netherlands_manifestos$party == 22521] <- "Christian Democratic Appeal"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22526] <- "CHR"
netherlands_manifestos$parname[netherlands_manifestos$party == 22526] <- "Christian Union"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22527] <- "CHR"
netherlands_manifestos$parname[netherlands_manifestos$party == 22527] <- "Reformed Political League"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22527] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22528] <- "CHR"
netherlands_manifestos$parname[netherlands_manifestos$party == 22528] <- "Reformatory Political Federation"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22711] <- "NAT"
netherlands_manifestos$parname[netherlands_manifestos$party == 22711] <- "Centre Democrats"
netherlands_manifestos$far_right[netherlands_manifestos$party == 22711] <- 1
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22711] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22720] <- "NAT"
netherlands_manifestos$parname[netherlands_manifestos$party == 22720] <- "List Pim Fortuyn"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22720] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22722] <- "NAT"
netherlands_manifestos$parname[netherlands_manifestos$party == 22722] <- "Party for Freedom"
netherlands_manifestos$far_right[netherlands_manifestos$party == 22722] <- 1
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22722] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22730] <- "NAT"
netherlands_manifestos$parname[netherlands_manifestos$party == 22730] <- "Forum for Democracy"
netherlands_manifestos$far_right[netherlands_manifestos$party == 22730] <- 1
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22730] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22951] <- "SIP"
netherlands_manifestos$parname[netherlands_manifestos$party == 22951] <- "Party for the Animals"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22951] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22952] <- "SIP"
netherlands_manifestos$parname[netherlands_manifestos$party == 22952] <- "Reformed Political Party"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22952] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22953] <- "SIP"
netherlands_manifestos$parname[netherlands_manifestos$party == 22953] <- "50Plus"
netherlands_manifestos$eurosceptic[netherlands_manifestos$party == 22953] <- 1
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22954] <- "SIP"
netherlands_manifestos$parname[netherlands_manifestos$party == 22954] <- "General Elderly Alliance"
netherlands_manifestos$parfam_cmp[netherlands_manifestos$party == 22955] <- "SIP"
netherlands_manifestos$parname[netherlands_manifestos$party == 22955] <- "Union 55+"
netherlands_manifestos$far_right <- as.factor(netherlands_manifestos$far_right)
netherlands_manifestos$eurosceptic <- as.factor(netherlands_manifestos$eurosceptic)

# Denmark
denmark_manifestos <- mp_metadata(countryname == "Denmark" & edate > as.Date("1990-01-01")) %>%
  filter(language == "danish") %>%
  subset(select = col_keep)
denmark_manifestos$state <- "Denmark"
denmark_manifestos$state_ab <- "DK"
denmark_manifestos$far_right <- 0
denmark_manifestos$eurosceptic <- 0
denmark_manifestos$date <- as.Date(paste0(denmark_manifestos$date, "01"), format = "%Y%m%d")
denmark_manifestos$year <- year(denmark_manifestos$date)
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13001] <- "LIB"
denmark_manifestos$parname[denmark_manifestos$party == 13001] <- "New Alliance/Liberal Alliance"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13110] <- "COM"
denmark_manifestos$parname[denmark_manifestos$party == 13110] <- "Alternativ"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13229] <- "COM"
denmark_manifestos$parname[denmark_manifestos$party == 13229] <- "Red-Green Unity List"
denmark_manifestos$eurosceptic[denmark_manifestos$party == 13229] <- 1
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13230] <- "COM"
denmark_manifestos$parname[denmark_manifestos$party == 13230] <- "Socialist People's Party"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 	13320] <- "SOC"
denmark_manifestos$parname[denmark_manifestos$party == 	13320] <- "Social Democratic Party"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13330] <- "CON"
denmark_manifestos$parname[denmark_manifestos$party == 13330] <- "Centre Democrats"
denmark_manifestos$parfam_cmp[denmark_manifestos$party ==	13410] <- "LIB"
denmark_manifestos$parname[denmark_manifestos$party == 13410] <- "Danish Social-Liberal Party"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13420] <- "LIB"
denmark_manifestos$parname[denmark_manifestos$party == 13420] <- "Liberals"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13520] <- "CHR"
denmark_manifestos$parname[denmark_manifestos$party == 13520] <- "Christian People's Party/Christian Democrats"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13620] <- "CON"
denmark_manifestos$parname[denmark_manifestos$party == 13620] <- "Conservative People's Party"
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13720] <- "NAT"
denmark_manifestos$parname[denmark_manifestos$party == 13720] <- "Danish People's Party"
denmark_manifestos$far_right[denmark_manifestos$party == 13720] <- 1
denmark_manifestos$eurosceptic[denmark_manifestos$party == 13720] <- 1
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13730] <- "NAT"
denmark_manifestos$parname[denmark_manifestos$party == 13730] <- "New Right"
denmark_manifestos$far_right[denmark_manifestos$party == 13730] <- 1
denmark_manifestos$eurosceptic[denmark_manifestos$party == 13730] <- 1
denmark_manifestos$parfam_cmp[denmark_manifestos$party == 13951] <- "NAT"
denmark_manifestos$parname[denmark_manifestos$party == 13951] <- "Progress Party"
denmark_manifestos$far_right[denmark_manifestos$party == 13951] <- 1
denmark_manifestos$eurosceptic[denmark_manifestos$party == 13951] <- 1
denmark_manifestos$far_right <- as.factor(denmark_manifestos$far_right)
denmark_manifestos$eurosceptic <- as.factor(denmark_manifestos$eurosceptic)

# Ireland
ireland_manifestos <- mp_metadata(countryname == "Ireland" & edate > as.Date("1990-01-01")) %>%
  filter(language == "english") %>%
  subset(select = col_keep)
ireland_manifestos$state <- "Ireland"
ireland_manifestos$state_ab <- "IE"
ireland_manifestos$far_right <- 0
ireland_manifestos$eurosceptic <- 0
ireland_manifestos$date <- as.Date(paste0(ireland_manifestos$date, "01"), format = "%Y%m%d")
ireland_manifestos$year <- year(ireland_manifestos$date)
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53021] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53021] <- "United Left Alliance"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53110] <- "ECO"
ireland_manifestos$parname[ireland_manifestos$party == 53110] <- "Green Party"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53221] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53221] <- "Democratic Left Party"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53230] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53230] <- "Socialist Party"
ireland_manifestos$eurosceptic[ireland_manifestos$party == 53230] <- 1
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53231] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53231] <- "People Before Profit Alliance"
ireland_manifestos$eurosceptic[ireland_manifestos$party == 53231] <- 1
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53240] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53240] <- "Anti-Austerity Alliance"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53250] <- "COM"
ireland_manifestos$parname[ireland_manifestos$party == 53250] <- "Workers and Unemployment Action"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53320] <- "SOC"
ireland_manifestos$parname[ireland_manifestos$party == 53320] <- "Labour Party"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53321] <- "SOC"
ireland_manifestos$parname[ireland_manifestos$party == 53321] <- "Social Democrats"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53420] <- "LIB"
ireland_manifestos$parname[ireland_manifestos$party == 53420] <- "Progressive Democrats"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53520] <- "CHR"
ireland_manifestos$parname[ireland_manifestos$party == 53520] <- "Family of the Irish"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53620] <- "CON"
ireland_manifestos$parname[ireland_manifestos$party == 53620] <- "Soldiers of Destiny"
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53951] <- "SIP"
ireland_manifestos$parname[ireland_manifestos$party == 53951] <- "Sinn Féin"
ireland_manifestos$eurosceptic[ireland_manifestos$party == 53951] <- 1
ireland_manifestos$parfam_cmp[ireland_manifestos$party == 53981] <- "SIP"
ireland_manifestos$parname[ireland_manifestos$party == 53981] <- "Independent Alliance"
ireland_manifestos$far_right <- as.factor(ireland_manifestos$far_right)
ireland_manifestos$eurosceptic <- as.factor(ireland_manifestos$eurosceptic)

# United Kingdom
uk_manifestos <- mp_metadata(countryname == "United Kingdom" & edate > as.Date("1990-01-01")) %>%
  filter(language == "english") %>%
  subset(select = col_keep)
uk_manifestos$state <- "United Kingdom"
uk_manifestos$state_ab <- "UK"
uk_manifestos$far_right <- 0
uk_manifestos$eurosceptic <- 0
uk_manifestos$date <- as.Date(paste0(uk_manifestos$date, "01"), format = "%Y%m%d")
uk_manifestos$year <- year(uk_manifestos$date)
uk_manifestos$parfam_cmp[uk_manifestos$party == 51110] <- "ECO"
uk_manifestos$parname[uk_manifestos$party == 51110] <- "Green Party of England and Wales"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51210] <- "COM"
uk_manifestos$parname[uk_manifestos$party == 51210] <- "Sinn Féin"
uk_manifestos$eurosceptic[uk_manifestos$party == 51210] <- 1
uk_manifestos$parfam_cmp[uk_manifestos$party == 51320] <- "SOC"
uk_manifestos$parname[uk_manifestos$party == 51320] <- "Labour Party"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51340] <- "SOC"
uk_manifestos$parname[uk_manifestos$party == 51340] <- "Social Democratic and Labour Party"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51421] <- "LIB"
uk_manifestos$parname[uk_manifestos$party == 51421] <- "Liberal Democrats"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51430] <- "LIB"
uk_manifestos$parname[uk_manifestos$party == 51430] <- "Alliance Party of Norther Ireland"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51620] <- "CON"
uk_manifestos$parname[uk_manifestos$party == 51620] <- "Conservative Party"
uk_manifestos$eurosceptic[uk_manifestos$party == 51620] <- 1
uk_manifestos$parfam_cmp[uk_manifestos$party == 51621] <- "CON"
uk_manifestos$parname[uk_manifestos$party == 51621] <- "Ulster Unionist Party"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51901] <- "ETH"
uk_manifestos$parname[uk_manifestos$party == 51901] <- "Plaid Cymru"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51902] <- "ETH"
uk_manifestos$parname[uk_manifestos$party == 51902] <- "Scottish National Party"
uk_manifestos$parfam_cmp[uk_manifestos$party == 51903] <- "ETH"
uk_manifestos$parname[uk_manifestos$party == 51903] <- "Democratic Unionist Party"
uk_manifestos$eurosceptic[uk_manifestos$party == 51903] <- 1
uk_manifestos$parfam_cmp[uk_manifestos$party == 51951] <- "SIP"
uk_manifestos$parname[uk_manifestos$party == 51951] <- "United Kingdom Independence Party"
uk_manifestos$far_right[uk_manifestos$party == 51951] <- 1
uk_manifestos$eurosceptic[uk_manifestos$party == 51951] <- 1
uk_manifestos$far_right <- as.factor(uk_manifestos$far_right)
uk_manifestos$eurosceptic <- as.factor(uk_manifestos$eurosceptic)

# Greece
greece_manifestos <- mp_metadata(countryname == "Greece" & edate > as.Date("1990-01-01")) %>%
  filter(language == "greek") %>%
  subset(select = col_keep)
greece_manifestos$state <- "Greece"
greece_manifestos$state_ab <- "EL"
greece_manifestos$far_right <- 0
greece_manifestos$eurosceptic <- 0
greece_manifestos$date <- as.Date(paste0(greece_manifestos$date, "01"), format = "%Y%m%d")
greece_manifestos$year <- year(greece_manifestos$date)
greece_manifestos$parfam_cmp[greece_manifestos$party == 34020] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34020] <- "Coalition of the Radical Left"
greece_manifestos$eurosceptic[greece_manifestos$party == 34020] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34210] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34210] <- "Communist Party of Greece"
greece_manifestos$eurosceptic[greece_manifestos$party == 34210] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34211] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34211] <- "Progressive Left Coalition"
greece_manifestos$eurosceptic[greece_manifestos$party == 34211] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34212] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34212] <- "Coalition of the Radical Left-Unionist Social Front"
greece_manifestos$eurosceptic[greece_manifestos$party == 34212] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34213] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34213] <- "Democratic Left"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34214] <- "COM"
greece_manifestos$parname[greece_manifestos$party == 34214] <- "Popular Unity"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34313] <- "SOC"
greece_manifestos$parname[greece_manifestos$party == 34313] <- "Panhellenic Socialist Movement"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34340] <- "SOC"
greece_manifestos$parname[greece_manifestos$party == 34340] <- "The River"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34410] <- "LIB"
greece_manifestos$parname[greece_manifestos$party == 34410] <- "Union of Centrists"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34511] <- "CHR"
greece_manifestos$parname[greece_manifestos$party == 34511] <- "New Democracy"
greece_manifestos$parfam_cmp[greece_manifestos$party == 34710] <- "NAT"
greece_manifestos$parname[greece_manifestos$party == 34710] <- "Popular Orthodox Rally"
greece_manifestos$far_right[greece_manifestos$party == 34710] <- 1
greece_manifestos$eurosceptic[greece_manifestos$party == 34710] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34720] <- "NAT"
greece_manifestos$parname[greece_manifestos$party == 34720] <- "Golden Dawn"
greece_manifestos$far_right[greece_manifestos$party == 34720] <- 1
greece_manifestos$eurosceptic[greece_manifestos$party == 34720] <- 1
greece_manifestos$parfam_cmp[greece_manifestos$party == 34730] <- "NAT"
greece_manifestos$parname[greece_manifestos$party == 34730] <- "Independent Greeks"
greece_manifestos$eurosceptic[greece_manifestos$party == 34730] <- 1
greece_manifestos$far_right <- as.factor(greece_manifestos$far_right)
greece_manifestos$eurosceptic <- as.factor(greece_manifestos$eurosceptic)

# Portugal
portugal_manifestos <- mp_metadata(countryname == "Portugal" & edate > as.Date("1990-01-01")) %>%
  filter(language == "portuguese" & party != 35229) %>%
  subset(select = col_keep)
portugal_manifestos$state <- "Portugal"
portugal_manifestos$state_ab <- "PT"
portugal_manifestos$far_right <- 0
portugal_manifestos$eurosceptic <- 0
portugal_manifestos$date <- as.Date(paste0(portugal_manifestos$date, "01"), format = "%Y%m%d")
portugal_manifestos$year <- year(portugal_manifestos$date)
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35060] <- "CON"
portugal_manifestos$parname[portugal_manifestos$party == 35060] <- "Portugal Ahead"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35110] <- "ECO"
portugal_manifestos$parname[portugal_manifestos$party == 35110] <- "Ecologist Party-The Greens"
portugal_manifestos$eurosceptic[portugal_manifestos$party == 35110] <- 1
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35120] <- "ECO"
portugal_manifestos$parname[portugal_manifestos$party == 35120] <- "People-Animals-Nature"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35130] <- "ECO"
portugal_manifestos$parname[portugal_manifestos$party == 35130] <- "Free"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35211] <- "COM"
portugal_manifestos$parname[portugal_manifestos$party == 35211] <- "Left Bloc"
portugal_manifestos$eurosceptic[portugal_manifestos$party == 35211] <- 1
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35220] <- "COM"
portugal_manifestos$parname[portugal_manifestos$party == 35220] <- "Portuguese Communist Party"
portugal_manifestos$eurosceptic[portugal_manifestos$party == 35220] <- 1
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35311] <- "SOC"
portugal_manifestos$parname[portugal_manifestos$party == 35311] <- "Socialist Party"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35313] <- "CON"
portugal_manifestos$parname[portugal_manifestos$party == 35313] <- "Social Democratic Party"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35410] <- "LIB"
portugal_manifestos$parname[portugal_manifestos$party == 35410] <- "Liberal Initiative"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35520] <- "CHR"
portugal_manifestos$parname[portugal_manifestos$party == 35520] <- "Social Democratic Center-Popular Party"
portugal_manifestos$parfam_cmp[portugal_manifestos$party == 35720] <- "NAT"
portugal_manifestos$parname[portugal_manifestos$party == 35720] <- "Enough"
portugal_manifestos$far_right[portugal_manifestos$party == 35720] <- 1
portugal_manifestos$eurosceptic[portugal_manifestos$party == 35720] <- 1
portugal_manifestos$far_right <- as.factor(portugal_manifestos$far_right)
portugal_manifestos$eurosceptic <- as.factor(portugal_manifestos$eurosceptic)

# Spain
spain_manifestos <- mp_metadata(countryname == "Spain" & edate > as.Date("1990-01-01")) %>%
  filter(language == "spanish") %>%
  subset(select = col_keep)
spain_manifestos$state <- "Spain"
spain_manifestos$state_ab <- "ES"
spain_manifestos$far_right <- 0
spain_manifestos$eurosceptic <- 0
spain_manifestos$date <- as.Date(paste0(spain_manifestos$date, "01"), format = "%Y%m%d")
spain_manifestos$year <- year(spain_manifestos$date)
spain_manifestos$parfam_cmp[spain_manifestos$party == 33020] <- "COM"
spain_manifestos$parname[spain_manifestos$party == 33020] <- "Popular Unity"
spain_manifestos$eurosceptic[spain_manifestos$party == 33020] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33025] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33025] <- "United We Can"
spain_manifestos$eurosceptic[spain_manifestos$party == 33025] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33091] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33091] <- "Future Yes"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33092] <- "SIP"
spain_manifestos$parname[spain_manifestos$party == 33092] <- "Amaiur"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33093] <- "SIP"
spain_manifestos$parname[spain_manifestos$party == 33093] <- "Commitment-Q"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33095] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33095] <- "Basque Country Unite"
spain_manifestos$eurosceptic[spain_manifestos$party == 33095] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33097] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33097] <- "In Tide"
spain_manifestos$eurosceptic[spain_manifestos$party == 33097] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33098] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33098] <- "Valencian Style"
spain_manifestos$eurosceptic[spain_manifestos$party == 33098] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33210] <- "COM"
spain_manifestos$parname[spain_manifestos$party == 33210] <- "Podemos"
spain_manifestos$eurosceptic[spain_manifestos$party == 33210] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33220] <- "COM"
spain_manifestos$parname[spain_manifestos$party == 33220] <- "United Left"
spain_manifestos$eurosceptic[spain_manifestos$party == 33220] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33230] <- "COM"
spain_manifestos$parname[spain_manifestos$party == 33230] <- "More Country-Equo"
spain_manifestos$eurosceptic[spain_manifestos$party == 33230] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33320] <- "SOC"
spain_manifestos$parname[spain_manifestos$party == 33320] <- "Spanish Socialist Workers' Party"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33420] <- "LIB"
spain_manifestos$parname[spain_manifestos$party == 33420] <- "Citizens"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33440] <- "LIB"
spain_manifestos$parname[spain_manifestos$party == 33440] <- "Union, Progress, and Democracy"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33512] <- "CHR"
spain_manifestos$parname[spain_manifestos$party == 33512] <- "Centre Democrats"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33610] <- "CON"
spain_manifestos$parname[spain_manifestos$party == 33610] <- "People's Party"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33611] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33611] <- "Convergence and Union"
spain_manifestos$parfam_cmp[spain_manifestos$party == 	33612] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 	33612] <- "Forum Asturias"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33710] <- "NAT"
spain_manifestos$parname[spain_manifestos$party == 33710] <- "Vox"
spain_manifestos$far_right[spain_manifestos$party == 33710] <- 1
spain_manifestos$eurosceptic[spain_manifestos$party == 33710] <- 1
spain_manifestos$parfam_cmp[spain_manifestos$party == 33902] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33902] <- "Basque Nationalist Party"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33903] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33903] <- "Basque Solidarity"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33905] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33905] <- "Catalan Republican Left"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33906] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33906] <- "Andalusian Party"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33907] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33907] <- "Canarian Coalition"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33909] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33909] <- "Aragonist Council"
spain_manifestos$parfam_cmp[spain_manifestos$party == 	33910] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 	33910] <- "Navarrese People's Union"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33911] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33911] <- "Democratic Convergence of Catalonia"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33912] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33912] <- "Together for Catalonia"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33913] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33913] <- "Regionalist Party of Cantabria"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33914] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33914] <- "More Commitment"
spain_manifestos$parfam_cmp[spain_manifestos$party == 33916] <- "ETH"
spain_manifestos$parname[spain_manifestos$party == 33916] <- "Teruel Exists"
spain_manifestos$far_right <- as.factor(spain_manifestos$far_right)
spain_manifestos$eurosceptic <- as.factor(spain_manifestos$eurosceptic)

# Austria
austria_manifestos <- mp_metadata(countryname == "Austria" & edate > as.Date("1995-01-01")) %>%
  filter(language == "german") %>%
  subset(select = col_keep)
austria_manifestos$state <- "Austria"
austria_manifestos$state_ab <- "AT"
austria_manifestos$far_right <- 0
austria_manifestos$eurosceptic <- 0
austria_manifestos$date <- as.Date(paste0(austria_manifestos$date, "01"), format = "%Y%m%d")
austria_manifestos$year <- year(austria_manifestos$date)
austria_manifestos$parfam_cmp[austria_manifestos$party == 42110] <- "ECO"
austria_manifestos$parname[austria_manifestos$party == 42110] <- "Greens"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42120] <- "ECO"
austria_manifestos$parname[austria_manifestos$party == 42120] <- "Peter Pilz List"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42220] <- "COM"
austria_manifestos$parname[austria_manifestos$party == 42220] <- "Austrian Communist Party"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42320] <- "SOC"
austria_manifestos$parname[austria_manifestos$party == 42320] <- "Social Democratic Party of Austria"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42420] <- "NAT"
austria_manifestos$parname[austria_manifestos$party == 42420] <- "Freedom Party of Austria"
austria_manifestos$far_right[austria_manifestos$party == 42420] <- 1
austria_manifestos$eurosceptic[austria_manifestos$party == 42420] <- 1
austria_manifestos$parfam_cmp[austria_manifestos$party == 42421] <- "LIB"
austria_manifestos$parname[austria_manifestos$party == 42421] <- "Liberal Forum"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42430] <- "LIB"
austria_manifestos$parname[austria_manifestos$party == 42430] <- "New Austria-Liberal Forum"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42520] <- "CHR"
austria_manifestos$parname[austria_manifestos$party == 42520] <- "Austrian People's Party"
austria_manifestos$parfam_cmp[austria_manifestos$party == 42710] <- "NAT"
austria_manifestos$parname[austria_manifestos$party == 42710] <- "Alliance for the Future of Austria"
austria_manifestos$far_right[austria_manifestos$party == 42710] <- 1
austria_manifestos$eurosceptic[austria_manifestos$party == 42710] <- 1
austria_manifestos$parfam_cmp[austria_manifestos$party == 42951] <- "SIP"
austria_manifestos$parname[austria_manifestos$party == 42951] <- "Team Stronach for Austria"
austria_manifestos$eurosceptic[austria_manifestos$party == 42951] <- 1
austria_manifestos$far_right <- as.factor(austria_manifestos$far_right)
austria_manifestos$eurosceptic <- as.factor(austria_manifestos$eurosceptic)

# Finland
finland_finnish_manifestos <- mp_metadata(countryname == "Finland" & edate > as.Date("1995-01-01")) %>%
  filter(language == "finnish") %>%
  subset(select = col_keep)
finland_finnish_manifestos$state <- "Finland"
finland_finnish_manifestos$state_ab <- "FI"
finland_finnish_manifestos$far_right <- 0
finland_finnish_manifestos$eurosceptic <- 0
finland_finnish_manifestos$date <- as.Date(paste0(finland_finnish_manifestos$date, "01"), format = "%Y%m%d")
finland_finnish_manifestos$year <- year(finland_finnish_manifestos$date)
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14110] <- "ECO"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14110] <- "Green Union"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14223] <- "COM"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14223] <- "Left Wing Alliance"
finland_finnish_manifestos$eurosceptic[finland_finnish_manifestos$party == 14223] <- 1
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14320] <- "SOC"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14320] <- "Finnish Social Democrats"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14430] <- "LIB"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14430] <- "Young Finnish Party"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14440] <- "LIB"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14440] <- "Movemen Now"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14520] <- "CHR"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14520] <- "Finnish Christian Union/Christian Democrats in Finland"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14620] <- "CON"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14620] <- "National Coalition"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14810] <- "AGR"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14810] <- "Finnish Centre"
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14820] <- "NAT"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14820] <- "True Finns"
finland_finnish_manifestos$far_right[finland_finnish_manifestos$party == 14820] <- 1
finland_finnish_manifestos$eurosceptic[finland_finnish_manifestos$party == 14820] <- 1
finland_finnish_manifestos$parfam_cmp[finland_finnish_manifestos$party == 14901] <- "ETH"
finland_finnish_manifestos$parname[finland_finnish_manifestos$party == 14901] <- "Swedish People's Party"
finland_finnish_manifestos$far_right <- as.factor(finland_finnish_manifestos$far_right)
finland_finnish_manifestos$eurosceptic <- as.factor(finland_finnish_manifestos$eurosceptic)

finland_swedish_manifestos <- mp_metadata(countryname == "Finland" & edate > as.Date("1995-01-01")) %>%
  filter(language == "swedish") %>%
  subset(select = col_keep)
finland_swedish_manifestos$state <- "Finland"
finland_swedish_manifestos$state_ab <- "FI"
finland_swedish_manifestos$far_right <- 0
finland_swedish_manifestos$eurosceptic <- 0
finland_swedish_manifestos$date <- as.Date(paste0(finland_swedish_manifestos$date, "01"), format = "%Y%m%d")
finland_swedish_manifestos$year <- year(finland_swedish_manifestos$date)
finland_swedish_manifestos$parfam_cmp[finland_swedish_manifestos$party == 14110] <- "ECO"
finland_swedish_manifestos$parname[finland_swedish_manifestos$party == 14110] <- "Green Union"
finland_swedish_manifestos$parfam_cmp[finland_swedish_manifestos$party == 14320] <- "SOC"
finland_swedish_manifestos$parname[finland_swedish_manifestos$party == 14320] <- "Finnish Social Democrats"
finland_swedish_manifestos$parfam_cmp[finland_swedish_manifestos$party == 14901] <- "ETH"
finland_swedish_manifestos$parname[finland_swedish_manifestos$party == 14901] <- "Swedish People's Party"
finland_swedish_manifestos$far_right <- as.factor(finland_swedish_manifestos$far_right)
finland_swedish_manifestos$eurosceptic <- as.factor(finland_swedish_manifestos$eurosceptic)

# Sweden
sweden_manifestos <- mp_metadata(countryname == "Sweden" & edate > as.Date("1995-01-01")) %>%
  filter(language == "swedish") %>%
  subset(select = col_keep)
sweden_manifestos$state <- "Sweden"
sweden_manifestos$state_ab <- "SE"
sweden_manifestos$far_right <- 0
sweden_manifestos$eurosceptic <- 0
sweden_manifestos$date <- as.Date(paste0(sweden_manifestos$date, "01"), format = "%Y%m%d")
sweden_manifestos$year <- year(sweden_manifestos$date)
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11110] <- "ECO"
sweden_manifestos$parname[sweden_manifestos$party == 11110] <- "Green Ecology Party"
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11220] <- "COM"
sweden_manifestos$parname[sweden_manifestos$party == 11220] <- "Left Party"
sweden_manifestos$eurosceptic[sweden_manifestos$party == 11220] <- 1
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11320] <- "SOC"
sweden_manifestos$parname[sweden_manifestos$party == 11320] <- "Social Democratic Labour Party"
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11420] <- "LIB"
sweden_manifestos$parname[sweden_manifestos$party == 11420] <- "Liberal People's Party"
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11520] <- "CHR"
sweden_manifestos$parname[sweden_manifestos$party == 11520] <- "Christian Democrats"
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11620] <- "CON"
sweden_manifestos$parname[sweden_manifestos$party == 11620] <- "Moderate Coalition Party"
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11710] <- "NAT"
sweden_manifestos$parname[sweden_manifestos$party == 11710] <- "Sweden Democrats"
sweden_manifestos$far_right[sweden_manifestos$party == 11710] <- 1
sweden_manifestos$eurosceptic[sweden_manifestos$party == 11710] <- 1
sweden_manifestos$parfam_cmp[sweden_manifestos$party == 11810] <- "AGR"
sweden_manifestos$parname[sweden_manifestos$party == 11810] <- "Centre Party"
sweden_manifestos$far_right <- as.factor(sweden_manifestos$far_right)
sweden_manifestos$eurosceptic <- as.factor(sweden_manifestos$eurosceptic)

# Cyprus
cyprus_manifestos <- mp_metadata(countryname == "Cyprus" & edate > as.Date("2004-05-01")) %>%
  filter(language == "greek") %>%
  subset(select = col_keep)
cyprus_manifestos$state <- "Cyprus"
cyprus_manifestos$state_ab <- "CY"
cyprus_manifestos$far_right <- 0
cyprus_manifestos$eurosceptic <- 0
cyprus_manifestos$date <- as.Date(paste0(cyprus_manifestos$date, "01"), format = "%Y%m%d")
cyprus_manifestos$year <- year(cyprus_manifestos$date)
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55110] <- "ECO"
cyprus_manifestos$parname[cyprus_manifestos$party == 55110] <- "Ecological and Environmental Movement"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55321] <- "SOC"
cyprus_manifestos$parname[cyprus_manifestos$party == 55321] <- "Progressive Party of Working People"
cyprus_manifestos$eurosceptic[cyprus_manifestos$party == 55321] <- 1
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55322] <- "SOC"
cyprus_manifestos$parname[cyprus_manifestos$party == 55322] <- "United Democratic Union of Cyprus"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55340] <- "SOC"
cyprus_manifestos$parname[cyprus_manifestos$party == 55340] <- "Citizens' Alliance"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55422] <- "LIB"
cyprus_manifestos$parname[cyprus_manifestos$party == 55422] <- "Democratic Party"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55430] <- "LIB"
cyprus_manifestos$parname[cyprus_manifestos$party == 55430] <- "European Party"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55610] <- "CON"
cyprus_manifestos$parname[cyprus_manifestos$party == 55610] <- "Solidarity Movement"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55711] <- "NAT"
cyprus_manifestos$parname[cyprus_manifestos$party == 55711] <- "Democratic Coalition"
cyprus_manifestos$parfam_cmp[cyprus_manifestos$party == 55720] <- "NAT"
cyprus_manifestos$parname[cyprus_manifestos$party == 55720] <- "National Popular Front"
cyprus_manifestos$far_right[cyprus_manifestos$party == 55720] <- 1
cyprus_manifestos$eurosceptic[cyprus_manifestos$party == 55720] <- 1
cyprus_manifestos$far_right <- as.factor(cyprus_manifestos$far_right)
cyprus_manifestos$eurosceptic <- as.factor(cyprus_manifestos$eurosceptic)

# Czechia
czechia_manifestos <- mp_metadata(countryname == "Czech Republic" & edate > as.Date("2004-05-01")) %>%
  filter(language == "czech") %>%
  subset(select = col_keep)
czechia_manifestos$state <- "Czechia"
czechia_manifestos$state_ab <- "CZ"
czechia_manifestos$far_right <- 0
czechia_manifestos$eurosceptic <- 0
czechia_manifestos$date <- as.Date(paste0(czechia_manifestos$date, "01"), format = "%Y%m%d")
czechia_manifestos$year <- year(czechia_manifestos$date)
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82110] <- "ECO"
czechia_manifestos$parname[czechia_manifestos$party == 82110] <- "Green Party"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82220] <- "COM"
czechia_manifestos$parname[czechia_manifestos$party == 82220] <- "Communist Party of Bohemia and Moravia"
czechia_manifestos$eurosceptic[czechia_manifestos$party == 82220] <- 1
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82320] <- "SOC"
czechia_manifestos$parname[czechia_manifestos$party == 82320] <- "Czech Social Democratic Party"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82413] <- "CON"
czechia_manifestos$parname[czechia_manifestos$party == 82413] <- "Civic Democratic Party"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82430] <- "LIB"
czechia_manifestos$parname[czechia_manifestos$party == 82430] <- "ANO 2011"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82523] <- "CHR"
czechia_manifestos$parname[czechia_manifestos$party == 82523] <- "Christian and Democratic Union-Czech People's Party"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82530] <- "CHR"
czechia_manifestos$parname[czechia_manifestos$party == 82530] <- "Tradition, Responsibilityt, Prosperity 09"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82610] <- "CON"
czechia_manifestos$parname[czechia_manifestos$party == 82610] <- "Mayors and Independents"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82720] <- "NAT"
czechia_manifestos$parname[czechia_manifestos$party == 82720] <- "Dawn of Direct Democracy"
czechia_manifestos$far_right[czechia_manifestos$party == 82720] <- 1
czechia_manifestos$eurosceptic[czechia_manifestos$party == 82720] <- 1
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82721] <- "NAT"
czechia_manifestos$parname[czechia_manifestos$party == 82721] <- "Freedom and Direct Democracy"
czechia_manifestos$far_right[czechia_manifestos$party == 82721] <- 1
czechia_manifestos$eurosceptic[czechia_manifestos$party == 82721] <- 1
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82952] <- "ETH"
czechia_manifestos$parname[czechia_manifestos$party == 82952] <- "Public Affairs"
czechia_manifestos$parfam_cmp[czechia_manifestos$party == 82953] <- "SIP"
czechia_manifestos$parname[czechia_manifestos$party == 82953] <- "Czech Pirate Party"
czechia_manifestos$far_right <- as.factor(czechia_manifestos$far_right)
czechia_manifestos$eurosceptic <- as.factor(czechia_manifestos$eurosceptic)

# Estonia
estonia_manifestos <- mp_metadata(countryname == "Estonia" & edate > as.Date("2004-05-01")) %>%
  filter(language == "estonian") %>%
  subset(select = col_keep)
estonia_manifestos$state <- "Estonia"
estonia_manifestos$state_ab <- "EE"
estonia_manifestos$far_right <- 0
estonia_manifestos$eurosceptic <- 0
estonia_manifestos$date <- as.Date(paste0(estonia_manifestos$date, "01"), format = "%Y%m%d")
estonia_manifestos$year <- year(estonia_manifestos$date)
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83110] <- "ECO"
estonia_manifestos$parname[estonia_manifestos$party == 83110] <- "Estonian Greens"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83410] <- "SOC"
estonia_manifestos$parname[estonia_manifestos$party == 83410] <- "Social Democratic Party"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83411] <- "LIB"
estonia_manifestos$parname[estonia_manifestos$party == 83411] <- "Estonian Center Party"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83430] <- "LIB"
estonia_manifestos$parname[estonia_manifestos$party == 83430] <- "Estonian Reform Party"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83440] <- "CON"
estonia_manifestos$parname[estonia_manifestos$party == 83440] <- "Free Party"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83611] <- "CON"
estonia_manifestos$parname[estonia_manifestos$party == 83611] <- "Pro Patria and Res Publica Union"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83612] <- "AGR"
estonia_manifestos$parname[estonia_manifestos$party == 83612] <- "Estonian People's Union"
estonia_manifestos$parfam_cmp[estonia_manifestos$party == 83720] <- "NAT"
estonia_manifestos$parname[estonia_manifestos$party == 83720] <- "Conservative People's Party of Estonia"
estonia_manifestos$far_right[estonia_manifestos$party == 83720] <- 1
estonia_manifestos$eurosceptic[estonia_manifestos$party == 83720] <- 1
estonia_manifestos$far_right <- as.factor(estonia_manifestos$far_right)
estonia_manifestos$eurosceptic <- as.factor(estonia_manifestos$eurosceptic)

# Hungary
hungary_manifestos <- mp_metadata(countryname == "Hungary" & edate > as.Date("2004-05-01")) %>%
  filter(language == "hungarian") %>%
  subset(select = col_keep)
hungary_manifestos$state <- "Hungary"
hungary_manifestos$state_ab <- "HU"
hungary_manifestos$far_right <- 0
hungary_manifestos$eurosceptic <- 0
hungary_manifestos$date <- as.Date(paste0(hungary_manifestos$date, "01"), format = "%Y%m%d")
hungary_manifestos$year <- year(hungary_manifestos$date)
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86110] <- "ECO"
hungary_manifestos$parname[hungary_manifestos$party == 86110] <- "Politics Can Be Different"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86111] <- "COM"
hungary_manifestos$parname[hungary_manifestos$party == 86111] <- "Dialogue for Hungary"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86220] <- "SOC"
hungary_manifestos$parname[hungary_manifestos$party == 86220] <- "Hungarian Socialist Party"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86221] <- "COM"
hungary_manifestos$parname[hungary_manifestos$party == 86221] <- "Democratic Coalition"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86320] <- "SOC"
hungary_manifestos$parname[hungary_manifestos$party == 86320] <- "Hungarian Social Democratic Party"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86340] <- "COM"
hungary_manifestos$parname[hungary_manifestos$party == 86340] <- "Together 2014-Dialogue for Hungary Electoral Alliance"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86421] <- "CON"
hungary_manifestos$parname[hungary_manifestos$party == 86421] <- "Fidesz"
hungary_manifestos$far_right[hungary_manifestos$party == 86421] <- 1
hungary_manifestos$eurosceptic[hungary_manifestos$party == 86421] <- 1
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86521] <- "CHR"
hungary_manifestos$parname[hungary_manifestos$party ==  86521] <- "Hungarian Democratic Forum"
hungary_manifestos$parfam_cmp[hungary_manifestos$party == 86710] <- "NAT"
hungary_manifestos$parname[hungary_manifestos$party == 86710] <- "Jobbik"
hungary_manifestos$far_right[hungary_manifestos$party == 86710] <- 1
hungary_manifestos$eurosceptic[hungary_manifestos$party == 86710] <- 1
hungary_manifestos$far_right <- as.factor(hungary_manifestos$far_right)
hungary_manifestos$eurosceptic <- as.factor(hungary_manifestos$eurosceptic)

# Latvia
latvia_manifestos <- mp_metadata(countryname == "Latvia" & edate > as.Date("2004-05-01")) %>%
  filter(language == "latvian") %>%
  subset(select = col_keep)
latvia_manifestos$state <- "Latvia"
latvia_manifestos$state_ab <- "LV"
latvia_manifestos$far_right <- 0
latvia_manifestos$eurosceptic <- 0
latvia_manifestos$date <- as.Date(paste0(latvia_manifestos$date, "01"), format = "%Y%m%d")
latvia_manifestos$year <- year(latvia_manifestos$date)
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87021] <- "COM"
latvia_manifestos$parname[latvia_manifestos$party == 87021] <- "Concord Centre"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87041] <- "LIB"
latvia_manifestos$parname[latvia_manifestos$party == 87041] <- "Lavia's First Party-Latvian Way Union"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87042] <- "LIB"
latvia_manifestos$parname[latvia_manifestos$party == 87042] <- "Development/For!"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87061] <- "LIB"
latvia_manifestos$parname[latvia_manifestos$party == 87061] <- "For a Good Latvia"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87062] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87062] <- "Unity"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87071] <- "NAT"
latvia_manifestos$parname[latvia_manifestos$party == 87071] <- "National Alliance"
latvia_manifestos$far_right[latvia_manifestos$party == 87071] <- 1
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87110] <- "AGR"
latvia_manifestos$parname[latvia_manifestos$party == 87110] <- "Greens' and Farmers' Union"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87340] <- "SOC"
latvia_manifestos$parname[latvia_manifestos$party == 87340] <- "Social Democratic Party Harmony"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87422] <- "SOC"
latvia_manifestos$parname[latvia_manifestos$party == 87422] <- "For Human Rights in a United Latvia"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87423] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87423] <- "New Era"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87610] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87610] <- "People's Party"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87620] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87620] <- "Zatlers' Reform Party"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87630] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87630] <- "For Latvia from the Heart"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87640] <- "CON"
latvia_manifestos$parname[latvia_manifestos$party == 87640] <- "New Conservative Party"
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87723] <- "NAT"
latvia_manifestos$parname[latvia_manifestos$party == 87723] <- "For Fatherland and Freedom-LNNK"
latvia_manifestos$far_right[latvia_manifestos$party == 87723] <- 1
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87730] <- "NAT"
latvia_manifestos$parname[latvia_manifestos$party == 87730] <- "Who Owns the State?"
latvia_manifestos$eurosceptic[latvia_manifestos$party == 87730] <- 1
latvia_manifestos$parfam_cmp[latvia_manifestos$party == 87901] <- "ETH"
latvia_manifestos$parname[latvia_manifestos$party == 87901] <- "Latvian Association of Regions"
latvia_manifestos$far_right <- as.factor(latvia_manifestos$far_right)
latvia_manifestos$eurosceptic <- as.factor(latvia_manifestos$eurosceptic)

# Lithuania
lithuania_manifestos <- mp_metadata(countryname == "Lithuania" & edate > as.Date("2004-05-01")) %>%
  filter(language == "lithuanian") %>%
  subset(select = col_keep)
lithuania_manifestos$state <- "Lithuania"
lithuania_manifestos$state_ab <- "LT"
lithuania_manifestos$far_right <- 0
lithuania_manifestos$eurosceptic <- 0
lithuania_manifestos$date <- as.Date(paste0(lithuania_manifestos$date, "01"), format = "%Y%m%d")
lithuania_manifestos$year <- year(lithuania_manifestos$date)
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88031] <- "SOC"
lithuania_manifestos$parname[lithuania_manifestos$party == 88031] <- "Working for Lithuania"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88041] <- "LIB"
lithuania_manifestos$parname[lithuania_manifestos$party == 88041] <- "Coalition of Rolandas Paksas-For Order and Justice"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88042] <- "LIB"
lithuania_manifestos$parname[lithuania_manifestos$party == 88042] <- "Coalition Labour Party and Youth"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88320] <- "SOC"
lithuania_manifestos$parname[lithuania_manifestos$party == 88320] <- "Lithuanian Social Democratic Party"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88430] <- "LIB"
lithuania_manifestos$parname[lithuania_manifestos$party == 88430] <- "Liberal and Centre Union"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88440] <- "LIB"
lithuania_manifestos$parname[lithuania_manifestos$party == 88440] <- "Labour Party"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88450] <- "LIB"
lithuania_manifestos$parname[lithuania_manifestos$party == 88450] <- "Liberal Movement"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88460] <- "NAT"
lithuania_manifestos$parname[lithuania_manifestos$party == 88460] <- "Order and Justice"
lithuania_manifestos$eurosceptic[lithuania_manifestos$party == 88460] <- 1
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88620] <- "CON"
lithuania_manifestos$parname[lithuania_manifestos$party == 88620] <- "Homeland Union"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88621] <- "CON"
lithuania_manifestos$parname[lithuania_manifestos$party == 88621] <- "Homeland Union-Lithuanian Christian Democrats"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88630] <- "CON"
lithuania_manifestos$parname[lithuania_manifestos$party == 88630] <- "National Resurrection Party"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88820] <- "AGR"
lithuania_manifestos$parname[lithuania_manifestos$party == 88820] <- "Lithuanian Peasant and Green Union"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88951] <- "ETH"
lithuania_manifestos$parname[lithuania_manifestos$party == 88951] <- "Election Action of Lithuania's Poles"
lithuania_manifestos$parfam_cmp[lithuania_manifestos$party == 88952] <- "SIP"
lithuania_manifestos$parname[lithuania_manifestos$party == 88952] <- "The Way of Courage"
lithuania_manifestos$far_right <- as.factor(lithuania_manifestos$far_right)
lithuania_manifestos$eurosceptic <- as.factor(lithuania_manifestos$eurosceptic)

# Poland
poland_manifestos <- mp_metadata(countryname == "Poland" & edate > as.Date("2004-05-01")) %>%
  filter(language == "polish") %>%
  subset(select = col_keep)
poland_manifestos$state <- "Poland"
poland_manifestos$state_ab <- "PL"
poland_manifestos$far_right <- 0
poland_manifestos$eurosceptic <- 0
poland_manifestos$date <- as.Date(paste0(poland_manifestos$date, "01"), format = "%Y%m%d")
poland_manifestos$year <- year(poland_manifestos$date)
poland_manifestos$parfam_cmp[poland_manifestos$party == 92021] <- "SOC"
poland_manifestos$parname[poland_manifestos$party == 92021] <- "Left and Democrats"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92210] <- "SOC"
poland_manifestos$parname[poland_manifestos$party == 92210] <- "Democratic Left Alliance"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92435] <- "LIB"
poland_manifestos$parname[poland_manifestos$party == 92435] <- "Civic Platform"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92436] <- "CON"
poland_manifestos$parname[poland_manifestos$party == 92436] <- "Law and Justice"
poland_manifestos$far_right[poland_manifestos$party == 92436] <- 1
poland_manifestos$eurosceptic[poland_manifestos$party == 92436] <- 1
poland_manifestos$parfam_cmp[poland_manifestos$party == 92440] <- "LIB"
poland_manifestos$parname[poland_manifestos$party == 92440] <- "Palikot's Movement"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92450] <- "LIB"
poland_manifestos$parname[poland_manifestos$party == 92450] <- "Modern"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92720] <- "NAT"
poland_manifestos$parname[poland_manifestos$party == 92720] <- "Kukiz'15"
poland_manifestos$far_right[poland_manifestos$party == 92720] <- 1
poland_manifestos$eurosceptic[poland_manifestos$party == 92720] <- 1
poland_manifestos$parfam_cmp[poland_manifestos$party == 92811] <- "AGR"
poland_manifestos$parname[poland_manifestos$party == 92811] <- "Polish Peasants' Party"
poland_manifestos$parfam_cmp[poland_manifestos$party == 92953] <- "ETH"
poland_manifestos$parname[poland_manifestos$party == 92953] <- "German Minority"
poland_manifestos$far_right <- as.factor(poland_manifestos$far_right)
poland_manifestos$eurosceptic <- as.factor(poland_manifestos$eurosceptic)

# Slovakia
slovakia_manifestos <- mp_metadata(countryname == "Slovakia" & edate > as.Date("2004-05-01")) %>%
  filter(language == "slovak") %>%
  subset(select = col_keep)
slovakia_manifestos$state <- "Slovakia"
slovakia_manifestos$state_ab <- "SK"
slovakia_manifestos$far_right <- 0
slovakia_manifestos$eurosceptic <- 0
slovakia_manifestos$date <- as.Date(paste0(slovakia_manifestos$date, "01"), format = "%Y%m%d")
slovakia_manifestos$year <- year(slovakia_manifestos$date)
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96423] <- "SOC"
slovakia_manifestos$parname[slovakia_manifestos$party == 96423] <- "Direction-Social Democracy"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96440] <- "LIB"
slovakia_manifestos$parname[slovakia_manifestos$party == 96440] <- "Freedom and Solidarity"
slovakia_manifestos$eurosceptic[slovakia_manifestos$party == 96440] <- 1
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96521] <- "CHR"
slovakia_manifestos$parname[slovakia_manifestos$party == 96521] <- "Christian Democratic Movement"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96523] <- "CHR"
slovakia_manifestos$parname[slovakia_manifestos$party == 96523] <- "Slovak Democratic and Christian Union-Democratic Party"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96610] <- "CON"
slovakia_manifestos$parname[slovakia_manifestos$party == 96610] <- "Civic Conservative Party"
slovakia_manifestos$eurosceptic[slovakia_manifestos$party == 96610] <- 1
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96620] <- "CON"
slovakia_manifestos$parname[slovakia_manifestos$party == 96620] <- "Ordinary People and Independent Personalities"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96630] <- "CON"
slovakia_manifestos$parname[slovakia_manifestos$party == 96630] <- "Network"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96710] <- "NAT"
slovakia_manifestos$parname[slovakia_manifestos$party == 96710] <- "Slovak National Party"
slovakia_manifestos$far_right[slovakia_manifestos$party == 96710] <- 1
slovakia_manifestos$eurosceptic[slovakia_manifestos$party == 96710] <- 1
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96711] <- "NAT"
slovakia_manifestos$parname[slovakia_manifestos$party == 96711] <- "Movement for a Democratic Slovakia"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96720] <- "NAT"
slovakia_manifestos$parname[slovakia_manifestos$party == 96720] <- "Kotleba-People's Party Our Slovakia"
slovakia_manifestos$far_right[slovakia_manifestos$party == 96720] <- 1
slovakia_manifestos$eurosceptic[slovakia_manifestos$party == 96720] <- 1
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96725] <- "NAT"
slovakia_manifestos$parname[slovakia_manifestos$party == 96725] <- "We Are Family"
slovakia_manifestos$far_right[slovakia_manifestos$party == 96725] <- 1
slovakia_manifestos$eurosceptic[slovakia_manifestos$party == 96725] <- 1
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96952] <- "ETH"
slovakia_manifestos$parname[slovakia_manifestos$party == 96952] <- "Party of the Hungarian Coalition"
slovakia_manifestos$parfam_cmp[slovakia_manifestos$party == 96955] <- "SIP"
slovakia_manifestos$parname[slovakia_manifestos$party == 96955] <- "Bridge"
slovakia_manifestos$far_right <- as.factor(slovakia_manifestos$far_right)
slovakia_manifestos$eurosceptic <- as.factor(slovakia_manifestos$eurosceptic)

# Slovenia
slovenia_manifestos <- mp_metadata(countryname == "Slovenia" & edate > as.Date("2004-05-01")) %>%
  filter(language == "slovenian") %>%
  subset(select = col_keep)
slovenia_manifestos$state <- "Slovenia"
slovenia_manifestos$state_ab <- "SI"
slovenia_manifestos$far_right <- 0
slovenia_manifestos$eurosceptic <- 0
slovenia_manifestos$date <- as.Date(paste0(slovenia_manifestos$date, "01"), format = "%Y%m%d")
slovenia_manifestos$year <- year(slovenia_manifestos$date)
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97020] <- "COM"
slovenia_manifestos$parname[slovenia_manifestos$party == 97020] <- "United Left"
slovenia_manifestos$eurosceptic[slovenia_manifestos$party == 97020] <- 1
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97230] <- "COM"
slovenia_manifestos$parname[slovenia_manifestos$party == 97230] <- "The Left"
slovenia_manifestos$eurosceptic[slovenia_manifestos$party == 97230] <- 1
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97322] <- "SOC"
slovenia_manifestos$parname[slovenia_manifestos$party == 97322] <- "Social Democratic Party"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97330] <- "CON"
slovenia_manifestos$parname[slovenia_manifestos$party == 97330] <- "Slovenian Democratic Party"
slovenia_manifestos$far_right[slovenia_manifestos$party == 97330] <- 1
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97340] <- "SOC"
slovenia_manifestos$parname[slovenia_manifestos$party == 97340] <- "Positive Slovenia"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97341] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97341] <- "List of Marjan Šarec"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97421] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97421] <- "Liberal Democracy of Slovenia"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97440] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97440] <- "For Real"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97450] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97450] <- "Gregor Virant's Civic List"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97460] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97460] <- "Alliance of Alenka Bratušek"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97461] <- "LIB"
slovenia_manifestos$parname[slovenia_manifestos$party == 97461] <- "Party of Miro Cerar/Modern Centre Party"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97521] <- "CHR"
slovenia_manifestos$parname[slovenia_manifestos$party == 97521] <- "Slovenian People's Party"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97522] <- "CHR"
slovenia_manifestos$parname[slovenia_manifestos$party == 97522] <- "New Slovenian Christian People's Party"
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97710] <- "NAT"
slovenia_manifestos$parname[slovenia_manifestos$party == 97710] <- "Slovenian National Party"
slovenia_manifestos$far_right[slovenia_manifestos$party == 97710] <- 1
slovenia_manifestos$eurosceptic[slovenia_manifestos$party == 97710] <- 1
slovenia_manifestos$parfam_cmp[slovenia_manifestos$party == 97951] <- "SIP"
slovenia_manifestos$parname[slovenia_manifestos$party == 97951] <- "Democratic Party of Pensioners of Slovenia"
slovenia_manifestos$far_right <- as.factor(slovenia_manifestos$far_right)
slovenia_manifestos$eurosceptic <- as.factor(slovenia_manifestos$eurosceptic)

# Bulgaria
bulgaria_manifestos <- mp_metadata(countryname == "Bulgaria" & edate > as.Date("2007-01-01")) %>%
  filter(language == "bulgarian") %>%
  subset(select = col_keep)
bulgaria_manifestos$state <- "Bulgaria"
bulgaria_manifestos$state_ab <- "BG"
bulgaria_manifestos$far_right <- 0
bulgaria_manifestos$eurosceptic <- 0
bulgaria_manifestos$date <- as.Date(paste0(bulgaria_manifestos$date, "01"), format = "%Y%m%d")
bulgaria_manifestos$year <- year(bulgaria_manifestos$date)
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80061] <- "CON"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80061] <- "Reformist Bloc"
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80062] <- "CON"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80062] <- "Patriotic Front-NFSB-VMRO"
bulgaria_manifestos$far_right[bulgaria_manifestos$party == 80062] <- 1
bulgaria_manifestos$eurosceptic[bulgaria_manifestos$party == 80062] <- 1
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80071] <- "NAT"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80071] <- "United Patriots"
bulgaria_manifestos$far_right[bulgaria_manifestos$party == 80071] <- 1
bulgaria_manifestos$eurosceptic[bulgaria_manifestos$party == 80071] <- 1
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80220] <- "SOC"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80220] <- "Bulgarian Socialist Party"
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80221] <- "SOC"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80221] <- "BSP-Left Bulgaria"
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80330] <- "SOC"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80330] <- "Alternative for Bulgarian Revival"
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80510] <- "CHR"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80510] <- "Citizens for European Development of Bulgaria"
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80630] <- "CON"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80630] <- "Bulgaria Without Censorship"
bulgaria_manifestos$eurosceptic[bulgaria_manifestos$party == 80630] <- 1
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80640] <- "CON"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80640] <- "Will"
bulgaria_manifestos$far_right[bulgaria_manifestos$party == 80640] <- 1
bulgaria_manifestos$eurosceptic[bulgaria_manifestos$party == 80640] <- 1
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 80710] <- "NAT"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 80710] <- "National Union Attack"
bulgaria_manifestos$far_right[bulgaria_manifestos$party == 80710] <- 1
bulgaria_manifestos$eurosceptic[bulgaria_manifestos$party == 80710] <- 1
bulgaria_manifestos$parfam_cmp[bulgaria_manifestos$party == 	80951] <- "ETH"
bulgaria_manifestos$parname[bulgaria_manifestos$party == 	80951] <- "Movement for Rights and Freedoms"
bulgaria_manifestos$far_right <- as.factor(bulgaria_manifestos$far_right)
bulgaria_manifestos$eurosceptic <- as.factor(bulgaria_manifestos$eurosceptic)

# Romania
romania_manifestos <- mp_metadata(countryname == "Romania" & edate > as.Date("2007-01-01")) %>%
  filter(language == "romanian") %>%
  subset(select = col_keep)
romania_manifestos$state <- "Romania"
romania_manifestos$state_ab <- "RO"
romania_manifestos$far_right <- 0
romania_manifestos$eurosceptic <- 0
romania_manifestos$date <- as.Date(paste0(romania_manifestos$date, "01"), format = "%Y%m%d")
romania_manifestos$year <- year(romania_manifestos$date)
romania_manifestos$parfam_cmp[romania_manifestos$party == 93031] <- "SOC"
romania_manifestos$parname[romania_manifestos$party == 93031] <- "Social Liberal Union"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93061] <- "CON"
romania_manifestos$parname[romania_manifestos$party == 93061] <- "Right Romania Alliance"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93223] <- "COM"
romania_manifestos$parname[romania_manifestos$party == 93223] <- "Social Democratic Party"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93420] <- "LIB"
romania_manifestos$parname[romania_manifestos$party == 93420] <- "Alliance of Liberals and Democrats"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93430] <- "LIB"
romania_manifestos$parname[romania_manifestos$party == 93430] <- "National Liberal Party"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93440] <- "LIB"
romania_manifestos$parname[romania_manifestos$party == 93440] <- "Save Romania Union"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93540] <- "CHR"
romania_manifestos$parname[romania_manifestos$party == 93540] <- "People's Movement Party"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93951] <- "ETH"
romania_manifestos$parname[romania_manifestos$party == 93951] <- "Hungarian Democratic Alliance of Romania"
romania_manifestos$parfam_cmp[romania_manifestos$party == 93981] <- "NAT"
romania_manifestos$parname[romania_manifestos$party == 93981] <- "People's Party-Dan Dianconescu"
romania_manifestos$far_right <- as.factor(romania_manifestos$far_right)
romania_manifestos$eurosceptic <- as.factor(romania_manifestos$eurosceptic)

# Croatia
croatia_manifestos <- mp_metadata(countryname == "Croatia" & edate > as.Date("2013-07-01")) %>%
  filter(language == "croatian") %>%
  subset(select = col_keep)
croatia_manifestos$state <- "Croatia"
croatia_manifestos$state_ab <- "HR"
croatia_manifestos$far_right <- 0
croatia_manifestos$eurosceptic <- 0
croatia_manifestos$date <- as.Date(paste0(croatia_manifestos$date, "01"), format = "%Y%m%d")
croatia_manifestos$year <- year(croatia_manifestos$date)
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81032] <- "SOC"
croatia_manifestos$parname[croatia_manifestos$party == 81032 ] <- "Croatia Is Growing/People's Coalition"
croatia_manifestos$far_right[croatia_manifestos$party == 81032 ] <- 1
croatia_manifestos$eurosceptic[croatia_manifestos$party == 81032 ] <- 1
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81043] <- "LIB"
croatia_manifestos$parname[croatia_manifestos$party == 81043] <- "Coalition for Prime Minister"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81061] <- "CON"
croatia_manifestos$parname[croatia_manifestos$party == 81061] <- "Patriotic Coalition"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81091] <- "ETH"
croatia_manifestos$parname[croatia_manifestos$party == 81091] <- "Our Own Right-Even Stronger Istria Coalition"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81450] <- "LIB"
croatia_manifestos$parname[croatia_manifestos$party == 81450] <- "People's Party-Reformists"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81460] <- "LIB"
croatia_manifestos$parname[croatia_manifestos$party == 81460] <- "Bridge of Independent Lists"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81711] <- "NAT"
croatia_manifestos$parname[croatia_manifestos$party == 81711] <- "Croatian Democratic Union"
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81952] <- "SIP"
croatia_manifestos$parname[croatia_manifestos$party == 81952] <- "Croatian Democratic Assembly of Slavonia and Baranja"
croatia_manifestos$far_right[croatia_manifestos$party == 81952] <- 1
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81960] <- "SIP"
croatia_manifestos$parname[croatia_manifestos$party == 81960] <- "Human Shield"
croatia_manifestos$eurosceptic[croatia_manifestos$party == 81960] <- 1
croatia_manifestos$parfam_cmp[croatia_manifestos$party == 81961] <- "SIP"
croatia_manifestos$parname[croatia_manifestos$party == 81961] <- "Milan Bandić 365-Party of Labour and Solidarity"
croatia_manifestos$far_right <- as.factor(croatia_manifestos$far_right)
croatia_manifestos$eurosceptic <- as.factor(croatia_manifestos$eurosceptic)


# Text Preprocessing 1-----
# Belgium
belgium_dutch_corpus <- belgium_dutch_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(belgium_dutch_corpus) <- belgium_dutch_manifestos$manifesto_id
belgium_dutch_tokens <- belgium_dutch_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
belgium_dutch_dfm <- belgium_dutch_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
belgium_dutch <- belgium_dutch_dfm %>%
  dfm_lookup(dictionary = dict_dutch) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
belgium_dutch_ntoken <- as.data.frame(ntoken(belgium_dutch_dfm)) %>%
  rename(n = 'ntoken(belgium_dutch_dfm)')
belgium_dutch_ntoken$manifesto_id <- rownames(belgium_dutch_ntoken)
belgium_dutch <- merge(belgium_dutch_manifestos, belgium_dutch,
                       by.x = "manifesto_id", by.y = "doc_id")
belgium_dutch <- merge(belgium_dutch, belgium_dutch_ntoken,
                       by.x = "manifesto_id", by.y = "manifesto_id")
belgium_dutch$civ_gen <- 0
belgium_dutch$civ_gen[belgium_dutch$civ_gen_n > 0] <- 1
belgium_dutch$civ_gen <- as.factor(belgium_dutch$civ_gen)
belgium_dutch$civ_gen_per <- belgium_dutch$civ_gen_n/belgium_dutch$n

belgium_french_corpus <- belgium_french_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(belgium_french_corpus) <- belgium_french_manifestos$manifesto_id
belgium_french_tokens <- belgium_french_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
belgium_french_dfm <- belgium_french_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
belgium_french <- belgium_french_dfm %>%
  dfm_lookup(dictionary = dict_french) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
belgium_french_ntoken <- as.data.frame(ntoken(belgium_french_dfm)) %>%
  rename(n = 'ntoken(belgium_french_dfm)')
belgium_french_ntoken$manifesto_id <- rownames(belgium_french_ntoken)
belgium_french <- merge(belgium_french_manifestos, belgium_french,
                        by.x = "manifesto_id", by.y = "doc_id")
belgium_french <- merge(belgium_french, belgium_french_ntoken,
                        by.x = "manifesto_id", by.y = "manifesto_id")
belgium_french$civ_gen <- 0
belgium_french$civ_gen[belgium_french$civ_gen_n > 0] <- 1
belgium_french$civ_gen <- as.factor(belgium_french$civ_gen)
belgium_french$civ_gen_per <- belgium_french$civ_gen_n/belgium_french$n


# France
france_corpus <- france_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(france_corpus) <- france_manifestos$manifesto_id
france_tokens <- france_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
france_dfm <- france_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
france <- france_dfm %>%
  dfm_lookup(dictionary = dict_french) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
france_ntoken <- as.data.frame(ntoken(france_dfm)) %>%
  rename(n = 'ntoken(france_dfm)')
france_ntoken$manifesto_id <- rownames(france_ntoken)
france <- merge(france_manifestos, france,
                by.x = "manifesto_id", by.y = "doc_id")
france <- merge(france, france_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
france$civ_gen <- 0
france$civ_gen[france$civ_gen_n > 0] <- 1
france$civ_gen <- as.factor(france$civ_gen)
france$civ_gen_per <- france$civ_gen_n/france$n


# Germany
germany_corpus <- germany_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(germany_corpus) <- germany_manifestos$manifesto_id
germany_tokens <- germany_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
germany_dfm <- germany_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
germany <- germany_dfm %>%
  dfm_lookup(dictionary = dict_german) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
germany_ntoken <- as.data.frame(ntoken(germany_dfm)) %>%
  rename(n = 'ntoken(germany_dfm)')
germany_ntoken$manifesto_id <- rownames(germany_ntoken)
germany <- merge(germany_manifestos, germany,
                 by.x = "manifesto_id", by.y = "doc_id")
germany <- merge(germany, germany_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
germany$civ_gen <- 0
germany$civ_gen[germany$civ_gen_n > 0] <- 1
germany$civ_gen <- as.factor(germany$civ_gen)
germany$civ_gen_per <- germany$civ_gen_n/germany$n


# Italy
italy_corpus <- italy_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(italy_corpus) <- italy_manifestos$manifesto_id
italy_tokens <- italy_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
italy_dfm <- italy_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
italy <- italy_dfm %>%
  dfm_lookup(dictionary = dict_italian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
italy_ntoken <- as.data.frame(ntoken(italy_dfm)) %>%
  rename(n = 'ntoken(italy_dfm)')
italy_ntoken$manifesto_id <- rownames(italy_ntoken)
italy <- merge(italy_manifestos, italy,
               by.x = "manifesto_id", by.y = "doc_id")
italy <- merge(italy, italy_ntoken,
               by.x = "manifesto_id", by.y = "manifesto_id")
italy$civ_gen <- 0
italy$civ_gen[italy$civ_gen_n > 0] <- 1
italy$civ_gen <- as.factor(italy$civ_gen)
italy$civ_gen_per <- italy$civ_gen_n/italy$n


# Luxembourg
luxembourg_french_corpus <- luxembourg_french_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(luxembourg_french_corpus) <- luxembourg_french_manifestos$manifesto_id
luxembourg_french_tokens <- luxembourg_french_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
luxembourg_french_dfm <- luxembourg_french_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
luxembourg_french <- luxembourg_french_dfm %>%
  dfm_lookup(dictionary = dict_french) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
luxembourg_french_ntoken <- as.data.frame(ntoken(luxembourg_french_dfm)) %>%
  rename(n = 'ntoken(luxembourg_french_dfm)')
luxembourg_french_ntoken$manifesto_id <- rownames(luxembourg_french_ntoken)
luxembourg_french <- merge(luxembourg_french_manifestos, luxembourg_french,
                           by.x = "manifesto_id", by.y = "doc_id")
luxembourg_french <- merge(luxembourg_french, luxembourg_french_ntoken,
                           by.x = "manifesto_id", by.y = "manifesto_id")
luxembourg_french$civ_gen <- 0
luxembourg_french$civ_gen[luxembourg_french$civ_gen_n > 0] <- 1
luxembourg_french$civ_gen <- as.factor(luxembourg_french$civ_gen)
luxembourg_french$civ_gen_per <- luxembourg_french$civ_gen_n/luxembourg_french$n

luxembourg_german_corpus <- luxembourg_german_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(luxembourg_german_corpus) <- luxembourg_german_manifestos$manifesto_id
luxembourg_german_tokens <- luxembourg_german_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
luxembourg_german_dfm <- luxembourg_german_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
luxembourg_german <- luxembourg_german_dfm %>%
  dfm_lookup(dictionary = dict_german) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
luxembourg_german_ntoken <- as.data.frame(ntoken(luxembourg_german_dfm)) %>%
  rename(n = 'ntoken(luxembourg_german_dfm)')
luxembourg_german_ntoken$manifesto_id <- rownames(luxembourg_german_ntoken)
luxembourg_german <- merge(luxembourg_german_manifestos, luxembourg_german,
                           by.x = "manifesto_id", by.y = "doc_id")
luxembourg_german <- merge(luxembourg_german, luxembourg_german_ntoken,
                           by.x = "manifesto_id", by.y = "manifesto_id")
luxembourg_german$civ_gen <- 0
luxembourg_german$civ_gen[luxembourg_german$civ_gen_n > 0] <- 1
luxembourg_german$civ_gen <- as.factor(luxembourg_german$civ_gen)
luxembourg_german$civ_gen_per <- luxembourg_german$civ_gen_n/luxembourg_german$n


# Netherlands
netherlands_corpus <- netherlands_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(netherlands_corpus) <- netherlands_manifestos$manifesto_id
netherlands_tokens <- netherlands_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
netherlands_dfm <- netherlands_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
netherlands <- netherlands_dfm %>%
  dfm_lookup(dictionary = dict_dutch) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
netherlands_ntoken <- as.data.frame(ntoken(netherlands_dfm)) %>%
  rename(n = 'ntoken(netherlands_dfm)')
netherlands_ntoken$manifesto_id <- rownames(netherlands_ntoken)
netherlands <- merge(netherlands_manifestos, netherlands,
                     by.x = "manifesto_id", by.y = "doc_id")
netherlands <- merge(netherlands, netherlands_ntoken,
                     by.x = "manifesto_id", by.y = "manifesto_id")
netherlands$civ_gen <- 0
netherlands$civ_gen[netherlands$civ_gen_n > 0] <- 1
netherlands$civ_gen <- as.factor(netherlands$civ_gen)
netherlands$civ_gen_per <- netherlands$civ_gen_n/netherlands$n


# Denmark
denmark_corpus <- denmark_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(denmark_corpus) <- denmark_manifestos$manifesto_id
denmark_tokens <- denmark_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
denmark_dfm <- denmark_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
denmark <- denmark_dfm %>%
  dfm_lookup(dictionary = dict_danish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
denmark_ntoken <- as.data.frame(ntoken(denmark_dfm)) %>%
  rename(n = 'ntoken(denmark_dfm)')
denmark_ntoken$manifesto_id <- rownames(denmark_ntoken)
denmark <- merge(denmark_manifestos, denmark,
                 by.x = "manifesto_id", by.y = "doc_id")
denmark <- merge(denmark, denmark_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
denmark$civ_gen <- 0
denmark$civ_gen[denmark$civ_gen_n > 0] <- 1
denmark$civ_gen <- as.factor(denmark$civ_gen)
denmark$civ_gen_per <- denmark$civ_gen_n/denmark$n


# Ireland
ireland_corpus <- ireland_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(ireland_corpus) <- ireland_manifestos$manifesto_id
ireland_tokens <- ireland_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
ireland_dfm <- ireland_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
ireland <- ireland_dfm %>%
  dfm_lookup(dictionary = dict_english) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
ireland_ntoken <- as.data.frame(ntoken(ireland_dfm)) %>%
  rename(n = 'ntoken(ireland_dfm)')
ireland_ntoken$manifesto_id <- rownames(ireland_ntoken)
ireland <- merge(ireland_manifestos, ireland,
                 by.x = "manifesto_id", by.y = "doc_id")
ireland <- merge(ireland, ireland_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
ireland$civ_gen <- 0
ireland$civ_gen[ireland$civ_gen_n > 0] <- 1
ireland$civ_gen <- as.factor(ireland$civ_gen)
ireland$civ_gen_per <- ireland$civ_gen_n/ireland$n


# United Kingdom
uk_corpus <- uk_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(uk_corpus) <- uk_manifestos$manifesto_id
uk_tokens <- uk_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
uk_dfm <- uk_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
uk <- uk_dfm %>%
  dfm_lookup(dictionary = dict_english) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
uk_ntoken <- as.data.frame(ntoken(uk_dfm)) %>%
  rename(n = 'ntoken(uk_dfm)')
uk_ntoken$manifesto_id <- rownames(uk_ntoken)
uk <- merge(uk_manifestos, uk,
            by.x = "manifesto_id", by.y = "doc_id")
uk <- merge(uk, uk_ntoken,
            by.x = "manifesto_id", by.y = "manifesto_id")
uk$civ_gen <- 0
uk$civ_gen[uk$civ_gen_n > 0] <- 1
uk$civ_gen <- as.factor(uk$civ_gen)
uk$civ_gen_per <- uk$civ_gen_n/uk$n


# Greece
greece_corpus <- greece_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(greece_corpus) <- greece_manifestos$manifesto_id
greece_tokens <- greece_corpus %>%
  tokens(what = "fastestword", remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE)
greece_dfm <- greece_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
greece <- greece_dfm %>%
  dfm_lookup(dictionary = dict_greek) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
greece_ntoken <- as.data.frame(ntoken(greece_dfm)) %>%
  rename(n = 'ntoken(greece_dfm)')
greece_ntoken$manifesto_id <- rownames(greece_ntoken)
greece <- merge(greece_manifestos, greece,
                by.x = "manifesto_id", by.y = "doc_id")
greece <- merge(greece, greece_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
greece$civ_gen <- 0
greece$civ_gen[greece$civ_gen_n > 0] <- 1
greece$civ_gen <- as.factor(greece$civ_gen)
greece$civ_gen_per <- greece$civ_gen_n/greece$n


# Portugal
portugal_corpus <- portugal_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(portugal_corpus) <- portugal_manifestos$manifesto_id
portugal_tokens <- portugal_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
portugal_dfm <- portugal_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
portugal <- portugal_dfm %>%
  dfm_lookup(dictionary = dict_portuguese) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
portugal_ntoken <- as.data.frame(ntoken(portugal_dfm)) %>%
  rename(n = 'ntoken(portugal_dfm)')
portugal_ntoken$manifesto_id <- rownames(portugal_ntoken)
portugal <- merge(portugal_manifestos, portugal,
                  by.x = "manifesto_id", by.y = "doc_id")
portugal <- merge(portugal, portugal_ntoken,
                  by.x = "manifesto_id", by.y = "manifesto_id")
portugal$civ_gen <- 0
portugal$civ_gen[portugal$civ_gen_n > 0] <- 1
portugal$civ_gen <- as.factor(portugal$civ_gen)
portugal$civ_gen_per <- portugal$civ_gen_n/portugal$n


# Spain
spain_corpus <- spain_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(spain_corpus) <- spain_manifestos$manifesto_id
spain_tokens <- spain_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
spain_dfm <- spain_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
spain <- spain_dfm %>%
  dfm_lookup(dictionary = dict_spanish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
spain_ntoken <- as.data.frame(ntoken(spain_dfm)) %>%
  rename(n = 'ntoken(spain_dfm)')
spain_ntoken$manifesto_id <- rownames(spain_ntoken)
spain <- merge(spain_manifestos, spain,
               by.x = "manifesto_id", by.y = "doc_id")
spain <- merge(spain, spain_ntoken,
               by.x = "manifesto_id", by.y = "manifesto_id")
spain$civ_gen <- 0
spain$civ_gen[spain$civ_gen_n > 0] <- 1
spain$civ_gen <- as.factor(spain$civ_gen)
spain$civ_gen_per <- spain$civ_gen_n/spain$n


# Austria
austria_corpus <- austria_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(austria_corpus) <- austria_manifestos$manifesto_id
austria_tokens <- austria_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
austria_dfm <- austria_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
austria <- austria_dfm %>%
  dfm_lookup(dictionary = dict_german) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
austria_ntoken <- as.data.frame(ntoken(austria_dfm)) %>%
  rename(n = 'ntoken(austria_dfm)')
austria_ntoken$manifesto_id <- rownames(austria_ntoken)
austria <- merge(austria_manifestos, austria,
                 by.x = "manifesto_id", by.y = "doc_id")
austria <- merge(austria, austria_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
austria$civ_gen <- 0
austria$civ_gen[austria$civ_gen_n > 0] <- 1
austria$civ_gen <- as.factor(austria$civ_gen)
austria$civ_gen_per <- austria$civ_gen_n/austria$n


# Finland
finland_finnish_corpus <- finland_finnish_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(finland_finnish_corpus) <- finland_finnish_manifestos$manifesto_id
finland_finnish_tokens <- finland_finnish_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
finland_finnish_dfm <- finland_finnish_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
finland_finnish <- finland_finnish_dfm %>%
  dfm_lookup(dictionary = dict_finnish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
finland_finnish_ntoken <- as.data.frame(ntoken(finland_finnish_dfm)) %>%
  rename(n = 'ntoken(finland_finnish_dfm)')
finland_finnish_ntoken$manifesto_id <- rownames(finland_finnish_ntoken)
finland_finnish <- merge(finland_finnish_manifestos, finland_finnish,
                         by.x = "manifesto_id", by.y = "doc_id")
finland_finnish <- merge(finland_finnish, finland_finnish_ntoken,
                         by.x = "manifesto_id", by.y = "manifesto_id")
finland_finnish$civ_gen <- 0
finland_finnish$civ_gen[finland_finnish$civ_gen_n > 0] <- 1
finland_finnish$civ_gen <- as.factor(finland_finnish$civ_gen)
finland_finnish$civ_gen_per <- finland_finnish$civ_gen_n/finland_finnish$n

finland_swedish_corpus <- finland_swedish_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(finland_swedish_corpus) <- finland_swedish_manifestos$manifesto_id
finland_swedish_tokens <- finland_swedish_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
finland_swedish_dfm <- finland_swedish_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
finland_swedish <- finland_swedish_dfm %>%
  dfm_lookup(dictionary = dict_swedish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
finland_swedish_ntoken <- as.data.frame(ntoken(finland_swedish_dfm)) %>%
  rename(n = 'ntoken(finland_swedish_dfm)')
finland_swedish_ntoken$manifesto_id <- rownames(finland_swedish_ntoken)
finland_swedish <- merge(finland_swedish_manifestos, finland_swedish,
                         by.x = "manifesto_id", by.y = "doc_id")
finland_swedish <- merge(finland_swedish, finland_swedish_ntoken,
                         by.x = "manifesto_id", by.y = "manifesto_id")
finland_swedish$civ_gen <- 0
finland_swedish$civ_gen[finland_swedish$civ_gen_n > 0] <- 1
finland_swedish$civ_gen <- as.factor(finland_swedish$civ_gen)
finland_swedish$civ_gen_per <- finland_swedish$civ_gen_n/finland_swedish$n


# Sweden
sweden_corpus <- sweden_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(sweden_corpus) <- sweden_manifestos$manifesto_id
sweden_tokens <- sweden_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
sweden_dfm <- sweden_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
sweden <- sweden_dfm %>%
  dfm_lookup(dictionary = dict_swedish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
sweden_ntoken <- as.data.frame(ntoken(sweden_dfm)) %>%
  rename(n = 'ntoken(sweden_dfm)')
sweden_ntoken$manifesto_id <- rownames(sweden_ntoken)
sweden <- merge(sweden_manifestos, sweden,
                by.x = "manifesto_id", by.y = "doc_id")
sweden <- merge(sweden, sweden_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
sweden$civ_gen <- 0
sweden$civ_gen[sweden$civ_gen_n > 0] <- 1
sweden$civ_gen <- as.factor(sweden$civ_gen)
sweden$civ_gen_per <- sweden$civ_gen_n/sweden$n


# Cyprus
cyprus_corpus <- cyprus_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(cyprus_corpus) <- cyprus_manifestos$manifesto_id
cyprus_tokens <- cyprus_corpus %>%
  tokens(what = "fastestword", remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE)
cyprus_dfm <- cyprus_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
cyprus <- cyprus_dfm %>%
  dfm_lookup(dictionary = dict_greek) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
cyprus_ntoken <- as.data.frame(ntoken(cyprus_dfm)) %>%
  rename(n = 'ntoken(cyprus_dfm)')
cyprus_ntoken$manifesto_id <- rownames(cyprus_ntoken)
cyprus <- merge(cyprus_manifestos, cyprus,
                by.x = "manifesto_id", by.y = "doc_id")
cyprus <- merge(cyprus, cyprus_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
cyprus$civ_gen <- 0
cyprus$civ_gen[cyprus$civ_gen_n > 0] <- 1
cyprus$civ_gen <- as.factor(cyprus$civ_gen)
cyprus$civ_gen_per <- cyprus$civ_gen_n/cyprus$n


# Czechia
czechia_corpus <- czechia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(czechia_corpus) <- czechia_manifestos$manifesto_id
czechia_tokens <- czechia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
czechia_dfm <- czechia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
czechia <- czechia_dfm %>%
  dfm_lookup(dictionary = dict_czech) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
czechia_ntoken <- as.data.frame(ntoken(czechia_dfm)) %>%
  rename(n = 'ntoken(czechia_dfm)')
czechia_ntoken$manifesto_id <- rownames(czechia_ntoken)
czechia <- merge(czechia_manifestos, czechia,
                 by.x = "manifesto_id", by.y = "doc_id")
czechia <- merge(czechia, czechia_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
czechia$civ_gen <- 0
czechia$civ_gen[czechia$civ_gen_n > 0] <- 1
czechia$civ_gen <- as.factor(czechia$civ_gen)
czechia$civ_gen_per <- czechia$civ_gen_n/czechia$n


# Estonia
estonia_corpus <- estonia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(estonia_corpus) <- estonia_manifestos$manifesto_id
estonia_tokens <- estonia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
estonia_dfm <- estonia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
estonia <- estonia_dfm %>%
  dfm_lookup(dictionary = dict_estonian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
estonia_ntoken <- as.data.frame(ntoken(estonia_dfm)) %>%
  rename(n = 'ntoken(estonia_dfm)')
estonia_ntoken$manifesto_id <- rownames(estonia_ntoken)
estonia <- merge(estonia_manifestos, estonia,
                 by.x = "manifesto_id", by.y = "doc_id")
estonia <- merge(estonia, estonia_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
estonia$civ_gen <- 0
estonia$civ_gen[estonia$civ_gen_n > 0] <- 1
estonia$civ_gen <- as.factor(estonia$civ_gen)
estonia$civ_gen_per <- estonia$civ_gen_n/estonia$n


# Hungary
hungary_corpus <- hungary_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(hungary_corpus) <- hungary_manifestos$manifesto_id
hungary_tokens <- hungary_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
hungary_dfm <- hungary_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
hungary <- hungary_dfm %>%
  dfm_lookup(dictionary = dict_hungarian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
hungary_ntoken <- as.data.frame(ntoken(hungary_dfm)) %>%
  rename(n = 'ntoken(hungary_dfm)')
hungary_ntoken$manifesto_id <- rownames(hungary_ntoken)
hungary <- merge(hungary_manifestos, hungary,
                 by.x = "manifesto_id", by.y = "doc_id")
hungary <- merge(hungary, hungary_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
hungary$civ_gen <- 0
hungary$civ_gen[hungary$civ_gen_n > 0] <- 1
hungary$civ_gen <- as.factor(hungary$civ_gen)
hungary$civ_gen_per <- hungary$civ_gen_n/hungary$n


# Latvia
latvia_corpus <- latvia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(latvia_corpus) <- latvia_manifestos$manifesto_id
latvia_tokens <- latvia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
latvia_dfm <- latvia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
latvia <- latvia_dfm %>%
  dfm_lookup(dictionary = dict_latvian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
latvia_ntoken <- as.data.frame(ntoken(latvia_dfm)) %>%
  rename(n = 'ntoken(latvia_dfm)')
latvia_ntoken$manifesto_id <- rownames(latvia_ntoken)
latvia <- merge(latvia_manifestos, latvia,
                by.x = "manifesto_id", by.y = "doc_id")
latvia <- merge(latvia, latvia_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
latvia$civ_gen <- 0
latvia$civ_gen[latvia$civ_gen_n > 0] <- 1
latvia$civ_gen <- as.factor(latvia$civ_gen)
latvia$civ_gen_per <- latvia$civ_gen_n/latvia$n


# Lithuania
lithuania_corpus <- lithuania_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(lithuania_corpus) <- lithuania_manifestos$manifesto_id
lithuania_tokens <- lithuania_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
lithuania_dfm <- lithuania_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
lithuania <- lithuania_dfm %>%
  dfm_lookup(dictionary = dict_lithuanian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
lithuania_ntoken <- as.data.frame(ntoken(lithuania_dfm)) %>%
  rename(n = 'ntoken(lithuania_dfm)')
lithuania_ntoken$manifesto_id <- rownames(lithuania_ntoken)
lithuania <- merge(lithuania_manifestos, lithuania,
                   by.x = "manifesto_id", by.y = "doc_id")
lithuania <- merge(lithuania, lithuania_ntoken,
                   by.x = "manifesto_id", by.y = "manifesto_id")
lithuania$civ_gen <- 0
lithuania$civ_gen[lithuania$civ_gen_n > 0] <- 1
lithuania$civ_gen <- as.factor(lithuania$civ_gen)
lithuania$civ_gen_per <- lithuania$civ_gen_n/lithuania$n


# Poland
poland_corpus <- poland_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(poland_corpus) <- poland_manifestos$manifesto_id
poland_tokens <- poland_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
poland_dfm <- poland_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
poland <- poland_dfm %>%
  dfm_lookup(dictionary = dict_polish) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
poland_ntoken <- as.data.frame(ntoken(poland_dfm)) %>%
  rename(n = 'ntoken(poland_dfm)')
poland_ntoken$manifesto_id <- rownames(poland_ntoken)
poland <- merge(poland_manifestos, poland,
                by.x = "manifesto_id", by.y = "doc_id")
poland <- merge(poland, poland_ntoken,
                by.x = "manifesto_id", by.y = "manifesto_id")
poland$civ_gen <- 0
poland$civ_gen[poland$civ_gen_n > 0] <- 1
poland$civ_gen <- as.factor(poland$civ_gen)
poland$civ_gen_per <- poland$civ_gen_n/poland$n


# Slovakia
slovakia_corpus <- slovakia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(slovakia_corpus) <- slovakia_manifestos$manifesto_id
slovakia_tokens <- slovakia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
slovakia_dfm <- slovakia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
slovakia <- slovakia_dfm %>%
  dfm_lookup(dictionary = dict_slovak) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
slovakia_ntoken <- as.data.frame(ntoken(slovakia_dfm)) %>%
  rename(n = 'ntoken(slovakia_dfm)')
slovakia_ntoken$manifesto_id <- rownames(slovakia_ntoken)
slovakia <- merge(slovakia_manifestos, slovakia,
                  by.x = "manifesto_id", by.y = "doc_id")
slovakia <- merge(slovakia, slovakia_ntoken,
                  by.x = "manifesto_id", by.y = "manifesto_id")
slovakia$civ_gen <- 0
slovakia$civ_gen[slovakia$civ_gen_n > 0] <- 1
slovakia$civ_gen <- as.factor(slovakia$civ_gen)
slovakia$civ_gen_per <- slovakia$civ_gen_n/slovakia$n


# Slovenia
slovenia_corpus <- slovenia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(slovenia_corpus) <- slovenia_manifestos$manifesto_id
slovenia_tokens <- slovenia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
slovenia_dfm <- slovenia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
slovenia <- slovenia_dfm %>%
  dfm_lookup(dictionary = dict_slovenian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
slovenia_ntoken <- as.data.frame(ntoken(slovenia_dfm)) %>%
  rename(n = 'ntoken(slovenia_dfm)')
slovenia_ntoken$manifesto_id <- rownames(slovenia_ntoken)
slovenia <- merge(slovenia_manifestos, slovenia,
                  by.x = "manifesto_id", by.y = "doc_id")
slovenia <- merge(slovenia, slovenia_ntoken,
                  by.x = "manifesto_id", by.y = "manifesto_id")
slovenia$civ_gen <- 0
slovenia$civ_gen[slovenia$civ_gen_n > 0] <- 1
slovenia$civ_gen <- as.factor(slovenia$civ_gen)
slovenia$civ_gen_per <- slovenia$civ_gen_n/slovenia$n


# Bulgaria
bulgaria_corpus <- bulgaria_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(bulgaria_corpus) <- bulgaria_manifestos$manifesto_id
bulgaria_tokens <- bulgaria_corpus %>%
  tokens(what = "fastestword", remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE)
bulgaria_dfm <- bulgaria_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
bulgaria <- bulgaria_dfm %>%
  dfm_lookup(dictionary = dict_bulgarian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
bulgaria_ntoken <- as.data.frame(ntoken(bulgaria_dfm)) %>%
  rename(n = 'ntoken(bulgaria_dfm)')
bulgaria_ntoken$manifesto_id <- rownames(bulgaria_ntoken)
bulgaria <- merge(bulgaria_manifestos, bulgaria,
                  by.x = "manifesto_id", by.y = "doc_id")
bulgaria <- merge(bulgaria, bulgaria_ntoken,
                  by.x = "manifesto_id", by.y = "manifesto_id")
bulgaria$civ_gen <- 0
bulgaria$civ_gen[bulgaria$civ_gen_n > 0] <- 1
bulgaria$civ_gen <- as.factor(bulgaria$civ_gen)
bulgaria$civ_gen_per <- bulgaria$civ_gen_n/bulgaria$n


# Romania
romania_corpus <- romania_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(romania_corpus) <- romania_manifestos$manifesto_id
romania_tokens <- romania_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
romania_dfm <- romania_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
romania <- romania_dfm %>%
  dfm_lookup(dictionary = dict_romanian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
romania_ntoken <- as.data.frame(ntoken(romania_dfm)) %>%
  rename(n = 'ntoken(romania_dfm)')
romania_ntoken$manifesto_id <- rownames(romania_ntoken)
romania <- merge(romania_manifestos, romania,
                 by.x = "manifesto_id", by.y = "doc_id")
romania <- merge(romania, romania_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
romania$civ_gen <- 0
romania$civ_gen[romania$civ_gen_n > 0] <- 1
romania$civ_gen <- as.factor(romania$civ_gen)
romania$civ_gen_per <- romania$civ_gen_n/romania$n


# Croatia
croatia_corpus <- croatia_manifestos %>%
  mp_corpus() %>%
  corpus()
docnames(croatia_corpus) <- croatia_manifestos$manifesto_id
croatia_tokens <- croatia_corpus %>%
  tokens(remove_punct = TRUE, remove_symbols = TRUE, 
         remove_separators = TRUE, remove_url = TRUE, remove_numbers = TRUE) %>%
  tokens_tolower()
croatia_dfm <- croatia_tokens %>%
  dfm() %>%
  dfm_group(manifesto_id)
croatia <- croatia_dfm %>%
  dfm_lookup(dictionary = dict_croatian) %>%
  convert(to = "data.frame") %>%
  rename(civ_gen_n = civ_gen)
croatia_ntoken <- as.data.frame(ntoken(croatia_dfm)) %>%
  rename(n = 'ntoken(croatia_dfm)')
croatia_ntoken$manifesto_id <- rownames(croatia_ntoken)
croatia <- merge(croatia_manifestos, croatia,
                 by.x = "manifesto_id", by.y = "doc_id")
croatia <- merge(croatia, croatia_ntoken,
                 by.x = "manifesto_id", by.y = "manifesto_id")
croatia$civ_gen <- 0
croatia$civ_gen[croatia$civ_gen_n > 0] <- 1
croatia$civ_gen <- as.factor(croatia$civ_gen)
croatia$civ_gen_per <- croatia$civ_gen_n/croatia$n


# Identify Multiword Phrases-----
belgium_dutch_kwic <- kwic(belgium_dutch_tokens, 
                           pattern = "beschaving*", 
                           window = 20)

belgium_french_kwic <- kwic(belgium_french_tokens, 
                            pattern = "civilis*", 
                            window = 20)

france_kwic <- kwic(france_tokens, 
                    pattern = "civilis*", 
                    window = 20)

germany_kwic <- kwic(germany_tokens, 
                     pattern = c("zivilisa*", "zivilisi*", "kultur*"), 
                     window = 20)

italy_kwic <- kwic(italy_tokens, 
                   pattern = c("civilizz*", "civilt*"), 
                   window = 20)

luxembourg_french_kwic <- kwic(luxembourg_french_tokens, 
                               pattern = "civilis*", 
                               window = 20)

luxembourg_german_kwic <- kwic(luxembourg_german_tokens, 
                               pattern = c("zivilisa*", "zivilisi*", "kultur*"), 
                               window = 20)

netherlands_kwic <- kwic(netherlands_tokens, 
                         pattern = "beschaving*", 
                         window = 20)

denmark_kwic <- kwic(denmark_tokens, 
                     pattern = "civilisation*", 
                     window = 20)

ireland_kwic <- kwic(ireland_tokens, 
                     pattern = c("civiliz*", "civilis*"), 
                     window = 20)

uk_kwic <- kwic(uk_tokens, 
                pattern = c("civiliz*", "civilis*"), 
                window = 20)

greece_kwic <- kwic(greece_tokens, 
                    pattern = c("\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3*"),
                    window = 20)

portugal_kwic <- kwic(portugal_tokens, 
                      pattern = c("civilizaç*", "civilizacion*"), 
                      window = 20)

spain_kwic <- kwic(spain_tokens, 
                   pattern = "civiliz*", 
                   window = 20)

austria_kwic <- kwic(austria_tokens, 
                     pattern = c("zivilisa*", "zivilisi*", "kultur*"), 
                     window = 20)

finland_finnish_kwic <- kwic(finland_finnish_tokens, 
                             pattern = "sivilisaatio*", 
                             window = 20)

finland_swedish_kwic <- kwic(finland_swedish_tokens, 
                             pattern = "civilisation*", 
                             window = 20)

sweden_kwic <- kwic(sweden_tokens, 
                    pattern = "civilisation*", 
                    window = 20)

cyprus_kwic <- kwic(cyprus_tokens, 
                    pattern = c("\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3*"),
                    window = 20)

czechia_kwic <- kwic(czechia_tokens, 
                     pattern = "civiliza*", 
                     window = 20)

estonia_kwic <- kwic(estonia_tokens, 
                     pattern = "tsivilisatsioon*", 
                     window = 20)

hungary_kwic <- kwic(hungary_tokens, 
                     pattern = "civilizáció*", 
                     window = 20)

latvia_kwic <- kwic(latvia_tokens, 
                    pattern = "civilizācij*", 
                    window = 20)

lithuania_kwic <- kwic(lithuania_tokens, 
                       pattern = "civilizaci*", 
                       window = 20)

poland_kwic <- kwic(poland_tokens, 
                    pattern = "cywilizac*", 
                    window = 20)

slovakia_kwic <- kwic(slovakia_tokens, 
                      pattern = c("civilizác*", "civilizačn*"), 
                      window = 20)

slovenia_kwic <- kwic(slovenia_tokens, 
                      pattern = "civilizacij*", 
                      window = 20)

bulgaria_kwic <- kwic(bulgaria_tokens, 
                      pattern = c("\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438*"), 
                      window = 20)

romania_kwic <- kwic(romania_tokens, 
                     pattern = c("civiliz*"), 
                     window = 20)

croatia_kwic <- kwic(croatia_tokens, pattern = "civilizacij*", 
                     window = 20)


# Dictionaries 2-----
dict_bulgarian2 <- dictionary(list(
  civ = c("\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0441\\u043a\\u0438\\u044f_\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u043e\\u043d\\u0435\\u043d*",
          "\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0441\\u043a\\u0430_\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
          "\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f_\\u043d\\u0430_\\u0411\\u044a\\u043b\\u0433\\u0430\\u0440\\u0438\\u044f*",
          "\\u0415\\u0433\\u0438\\u043f\\u0435\\u0442\\u0441\\u043a\\u0430\\u0442\\u0430_\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
          "\\u0415\\u0432\\u0440\\u043e\\u043f\\u0435\\u0439\\u0441\\u043a\\u0430\\u0442\\u0430_\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
          "\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f_\\u043d\\u0430_\\u0442\\u0440\\u0430\\u043a\\u043e-\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0438\\u0442\\u0435*")))
bulgarian_multiword <- c("\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0441\\u043a\\u0438\\u044f \\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u043e\\u043d\\u0435\\u043d*",
                         "\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0441\\u043a\\u0430 \\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
                         "\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f \\u043d\\u0430 \\u0411\\u044a\\u043b\\u0433\\u0430\\u0440\\u0438\\u044f*",
                         "\\u0415\\u0433\\u0438\\u043f\\u0435\\u0442\\u0441\\u043a\\u0430\\u0442\\u0430 \\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
                         "\\u0415\\u0432\\u0440\\u043e\\u043f\\u0435\\u0439\\u0441\\u043a\\u0430\\u0442\\u0430 \\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f*",
                         "\\u0446\\u0438\\u0432\\u0438\\u043b\\u0438\\u0437\\u0430\\u0446\\u0438\\u044f \\u043d\\u0430 \\u0442\\u0440\\u0430\\u043a\\u043e-\\u0431\\u044a\\u043b\\u0433\\u0430\\u0440\\u0438\\u0442\\u0435*")
dict_croatian2 <- dictionary(list(
  civ = c("srednjoeuropskom_civilizacijskom", "civilizacijskih_dostignuća",
          "civilizacijski_doseg", "civilizacijskim_normama",
          "civilizacijskih_vrijednosti","civilizacijsko_bogatstvo",
          "civilizacijski_kulturni_doseg", "europskim_civilizacijskim")))
croatian_multiword <- c("srednjoeuropskom civilizacijskom", "civilizacijskih dostignuća",
                        "civilizacijski doseg", "civilizacijskim normama",
                        "civilizacijskih vrijednosti","civilizacijsko bogatstvo",
                        "civilizacijski kulturni doseg", "europskim civilizacijskim")
dict_czech2 <- dictionary(list(
  civ = c("vyspělé_civilizace", "žádná_civilizace",
          "křesťanský_civilizační", "civilizačních_základech",
          "euroamerické_civilizace", "euroatlantické_civilizace",
          "naší_civilizace", "transatlantického_jádra_demokratické_civilizace",
          "západní_civilizace", "západní_civilizaci",
          "západního_civilizačního")))
czech_multiword <- c("vyspělé civilizace", "žádná civilizace",
                     "křesťanský civilizační", "civilizačních základech",
                     "euroamerické civilizace", "euroatlantické civilizace",
                     "naší civilizace", "transatlantického jádra demokratické civilizace",
                     "západní civilizace", "západní civilizaci",
                     "západního civilizačního")
dict_danish2 <- dictionary(list(
  civ = c("civilisation_og_kultur", "civilisationens_kamp",
          "europæiske_civilisation", "indvandrede_civilisationer",
          "vores_civilisation")))
danish_multiword <- c("civilisation og kultur", "civilisationens kamp",
                      "europæiske civilisation", "indvandrede civilisationer",
                      "vores civilisation")
dict_dutch2 <- dictionary(list(
  civ = c("beschaving_en_cultuur", "beschaving_in_al_haar_veelvoud",
          "beschaving_die_in_sommige_gebieden", "beschavingswortels",
          "botsing_tussen_beschavingen", "botsende_beschavingen",
          "nederlandse_beschaving", "europese_beschaving",
          "hoogstaande_beschavingen", "hoog_ontwikkelde_beschaving",
          "humanistische_beschavingselementen", "zijn_beschaving",
          "joodse_beschaving", "onze_beschaving*",
          "wij_in_het_westen_bepalen_wat_beschaving", "westerse_beschaving")))
dutch_multiword <- c("beschaving en cultuur", "beschaving in al haar veelvoud",
                     "beschaving die in sommige gebieden", "beschavingswortels",
                     "botsing tussen beschavingen", "botsende beschavingen",
                     "nederlandse beschaving", "europese beschaving",
                     "hoogstaande beschavingen", "hoog ontwikkelde beschaving",
                     "humanistische beschavingselementen", "zijn beschaving",
                     "joodse beschaving", "onze beschaving*",
                     "wij in het westen bepalen wat beschaving", "westerse beschaving")
dict_english2 <- dictionary(list(
  civ = c("civilised_values")))
english_multiword <- c("civilised values")
dict_estonian2 <- dictionary(list(
  civ = c("tehnilisel_tsivilisatsioonil")))
estonian_multiword <- c("tehnilisel tsivilisatsioonil")
dict_finnish2 <- dictionary(list(
  civ = c("")))
dict_french2 <- dictionary(list(
  civ = c("caractéristiques_d’une_civilisation", "choix_de_civilisation",
          "choc_des_civilisations", "dialogue_entre_les_civilisations",
          "dialogue_substantiel_entre_les_civilisations", "chaque_civilisation",
          "civilisation_européenne", "civilisation_française",
          "génie_de_toutes_les_civilisations", "l’histoire_et_la_civilisation",
          "l’histoire_des_civilisations", "vieille_civilisation",
          "notre_civilisation", "nos_civilisations",
          "modèle_de_civilisation", "les_peuples_les_civilisations",
          "enjeu_de_civilisation", "leur_civilisation",
          "valeurs_et_les_civilisations")))
french_multiword <- c("caractéristiques d’une civilisation", "choix de civilisation",
                      "choc des civilisations", "dialogue entre les civilisations",
                      "dialogue substantiel entre les civilisations", "chaque civilisation",
                      "civilisation européenne", "civilisation française",
                      "génie de toutes les civilisations", "l’histoire et la civilisation",
                      "l’histoire des civilisations", "vieille civilisation",
                      "notre civilisation", "nos civilisations",
                      "modèle de civilisation", "les peuples les civilisations",
                      "enjeu de civilisation", "leur civilisation",
                      "valeurs et les civilisations")
dict_german2 <- dictionary(list(
  civ = c("zivilisatorische_errungenschaft", "zivilisatorischen_errungenschaften",
          "zivilisatorische_errungenschaften", "zivilisatorischen_und_kulturellen_traditionen",
          "zivilisatorischen_ausdrucksformen", "zivilisatorischen_rückschritt",
          "traditionen_in_zivilisation", "dialog_der_zivilisationen",
          "europäische_zivilisation", "weltweiten_zivilisation",
          "menschlichen_zivilisation", "industrielle_zivilisation",
          "westlichen_zivilisationsmodells", "christliche_und_humanistische_kultur",
          "christlich-abendländischen_kulturkreises", "kulturkampf_zwischen_abendland",
          "kampfs_der_kulturen", "kampf_der_kulturen",
          "gemeinsame_kulturelle_erbe_europas", "kulturellen_einheit_europas",
          "dialog_der_kulturen", "europäische_kultur*",
          "europäisches_kulturelles", "europäischen_kulturgedanken",
          "muslimischen_kulturkreis", "religionen_aus_unterschiedlichen_kulturen",
          "abendländischen_kultur", "römischer_kultur")))
german_multiword <- c("zivilisatorische errungenschaft", "zivilisatorischen errungenschaften",
                      "zivilisatorische errungenschaften", "zivilisatorischen und kulturellen traditionen",
                      "zivilisatorischen ausdrucksformen", "zivilisatorischen rückschritt",
                      "traditionen in zivilisation", "dialog der zivilisationen",
                      "europäische zivilisation", "weltweiten zivilisation",
                      "menschlichen zivilisation", "industrielle zivilisation",
                      "westlichen zivilisationsmodells", "christliche und humanistische kultur",
                      "christlich-abendländischen kulturkreises", "kulturkampf zwischen abendland",
                      "kampfs der kulturen", "kampf der kulturen",
                      "gemeinsame kulturelle erbe europas", "kulturellen einheit europas",
                      "dialog der kulturen", "europäische kultur*",
                      "europäisches kulturelles", "europäischen kulturgedanken",
                      "muslimischen kulturkreis", "religionen aus unterschiedlichen kulturen",
                      "abendländischen kultur", "römischer kultur")
dict_greek2 <- dictionary(list(
  civ = c("\\u03c0\\u03b1\\u03bb\\u03b1\\u03b9\\u03cc\\u03c4\\u03b1\\u03c4\\u03bf\\u03c5\\u03c2_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd\\u03c2*",
          "\\u03b4\\u03b9\\u03ac\\u03bb\\u03bf\\u03b3\\u03bf_\\u03c4\\u03c9\\u03bd_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03ce\\u03bd*",
          "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ae_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae_\\u03ba\\u03bb\\u03b7\\u03c1\\u03bf\\u03bd\\u03bf\\u03bc\\u03b9\\u03ac*",
          "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ce\\u03bd_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03b9\\u03ba\\u03ce\\u03bd_\\u03b1\\u03bd\\u03b1\\u03c6\\u03bf\\u03c1\\u03ce\\u03bd_\\u03bc\\u03b1\\u03c2_\\u03bc\\u03b5_\\u03c4\\u03bf\\u03bd_\\u03b4\\u03c5\\u03c4\\u03b9\\u03ba\\u03cc*",
          "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ae_\\u0395\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae*",
          "\\u03ba\\u03bf\\u03b9\\u03c4\\u03af\\u03b4\\u03b1\\u03c2_\\u03c4\\u03bf\\u03c5_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
          "\\u03ba\\u03bf\\u03b9\\u03c4\\u03af\\u03b4\\u03b1_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
          "\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae\\u03c2_\\u03c6\\u03c5\\u03c3\\u03b9\\u03bf\\u03b3\\u03bd\\u03c9\\u03bc\\u03af\\u03b1\\u03c2_\\u03c4\\u03b7\\u03c2_\\u03b5\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae\\u03c2_\\u03ad\\u03bd\\u03c9\\u03c3\\u03b7\\u03c2*",
          "\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae\\u03c2_\\u03c4\\u03b7\\u03c2_\\u03c4\\u03b1\\u03c5\\u03c4\\u03cc\\u03c4\\u03b7\\u03c4\\u03b1\\u03c2_\\u03c9\\u03c2_\\u03bc\\u03ad\\u03bb\\u03bf\\u03c2_\\u03b5\\u03bd\\u03cc\\u03c2_\\u03b5\\u03c5\\u03c1\\u03cd\\u03c4\\u03b5\\u03c1\\u03bf\\u03c5_\\u03c5\\u03c0\\u03b5\\u03c1\\u03b5\\u03b8\\u03bd\\u03b9\\u03ba\\u03bf\\u03cd_\\u03c3\\u03c5\\u03bd\\u03cc\\u03bb\\u03bf\\u03c5*",
          "\\u03b5\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03b9\\u03ba\\u03ae_\\u03c4\\u03b1\\u03c5\\u03c4\\u03cc\\u03c4\\u03b7\\u03c4\\u03b1*",
          "\\u03b4\\u03c5\\u03c4\\u03b9\\u03ba\\u03bf\\u03cd_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
          "\\u03c0\\u03b1\\u03b3\\u03ba\\u03cc\\u03c3\\u03bc\\u03b9\\u03bf_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03cc*",
          "\\u03c0\\u03b1\\u03b3\\u03ba\\u03cc\\u03c3µ\\u03b9\\u03bf\\u03c5_\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3µ\\u03bf\\u03cd*")))
greek_multiword <- c("\\u03c0\\u03b1\\u03bb\\u03b1\\u03b9\\u03cc\\u03c4\\u03b1\\u03c4\\u03bf\\u03c5\\u03c2 \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd\\u03c2*",
                     "\\u03b4\\u03b9\\u03ac\\u03bb\\u03bf\\u03b3\\u03bf \\u03c4\\u03c9\\u03bd \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03ce\\u03bd*",
                     "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ae \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae \\u03ba\\u03bb\\u03b7\\u03c1\\u03bf\\u03bd\\u03bf\\u03bc\\u03b9\\u03ac*",
                     "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ce\\u03bd \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03b9\\u03ba\\u03ce\\u03bd \\u03b1\\u03bd\\u03b1\\u03c6\\u03bf\\u03c1\\u03ce\\u03bd \\u03bc\\u03b1\\u03c2 \\u03bc\\u03b5 \\u03c4\\u03bf\\u03bd \\u03b4\\u03c5\\u03c4\\u03b9\\u03ba\\u03cc*",
                     "\\u03ba\\u03bf\\u03b9\\u03bd\\u03ae \\u0395\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae*",
                     "\\u03ba\\u03bf\\u03b9\\u03c4\\u03af\\u03b4\\u03b1\\u03c2 \\u03c4\\u03bf\\u03c5 \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
                     "\\u03ba\\u03bf\\u03b9\\u03c4\\u03af\\u03b4\\u03b1 \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
                     "\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae\\u03c2 \\u03c6\\u03c5\\u03c3\\u03b9\\u03bf\\u03b3\\u03bd\\u03c9\\u03bc\\u03af\\u03b1\\u03c2 \\u03c4\\u03b7\\u03c2 \\u03b5\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae\\u03c2 \\u03ad\\u03bd\\u03c9\\u03c3\\u03b7\\u03c2*",
                     "\\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03c4\\u03b9\\u03ba\\u03ae\\u03c2 \\u03c4\\u03b7\\u03c2 \\u03c4\\u03b1\\u03c5\\u03c4\\u03cc\\u03c4\\u03b7\\u03c4\\u03b1\\u03c2 \\u03c9\\u03c2 \\u03bc\\u03ad\\u03bb\\u03bf\\u03c2 \\u03b5\\u03bd\\u03cc\\u03c2 \\u03b5\\u03c5\\u03c1\\u03cd\\u03c4\\u03b5\\u03c1\\u03bf\\u03c5 \\u03c5\\u03c0\\u03b5\\u03c1\\u03b5\\u03b8\\u03bd\\u03b9\\u03ba\\u03bf\\u03cd \\u03c3\\u03c5\\u03bd\\u03cc\\u03bb\\u03bf\\u03c5*",
                     "\\u03b5\\u03c5\\u03c1\\u03c9\\u03c0\\u03b1\\u03ca\\u03ba\\u03ae \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03b9\\u03ba\\u03ae \\u03c4\\u03b1\\u03c5\\u03c4\\u03cc\\u03c4\\u03b7\\u03c4\\u03b1*",
                     "\\u03b4\\u03c5\\u03c4\\u03b9\\u03ba\\u03bf\\u03cd \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03bf\\u03cd*",
                     "\\u03c0\\u03b1\\u03b3\\u03ba\\u03cc\\u03c3\\u03bc\\u03b9\\u03bf \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3\\u03bc\\u03cc*",
                     "\\u03c0\\u03b1\\u03b3\\u03ba\\u03cc\\u03c3µ\\u03b9\\u03bf\\u03c5 \\u03c0\\u03bf\\u03bb\\u03b9\\u03c4\\u03b9\\u03c3µ\\u03bf\\u03cd*")
dict_hungarian2 <- dictionary(list(
  civ = c("civilizációs_örökségünkre", "civilizációk",
          "emberi_civilizáció", "ipari_civilizáció")))
hungarian_multiword <- c("civilizációs örökségünkre", "civilizációk",
                         "emberi civilizáció", "ipari civilizáció")
dict_italian2 <- dictionary(list(
  civ = c("fra_la_civiltà", "civiltà_cristian*",
          "civiltà_e_di_una_cultura", "conquiste_di_civiltà",
          "modello_di_civiltà", "modelli_di_civiltà", 
          "valori_della_civiltà", "civiltà_del_continente", 
          "cardine_della_civilizzazione", "civiltà_europea", 
          "storia_di_civilizzazione", "civiltà_moderna", 
          "altre_civiltà", "nostra_civiltà", 
          "civiltà_romana", "società_e_di_una_civiltà", 
          "civiltà_occidentale")))
italian_multiword <- c("fra la civiltà", "civiltà cristian*",
                       "civiltà e di una cultura", "conquiste di civiltà",
                       "modello di civiltà", "modelli di civiltà", 
                       "valori della civiltà", "civiltà del continente", 
                       "cardine della civilizzazione", "civiltà europea", 
                       "storia di civilizzazione", "civiltà moderna", 
                       "altre civiltà", "nostra civiltà", 
                       "civiltà romana", "società e di una civiltà", 
                       "civiltà occidentale")
dict_latvian2 <- dictionary(list(
  civ = c("rietumu_civilizācijai")))
latvian_multiword <- c("rietumu civilizācijai")
dict_lithuanian2 <- dictionary(list(
  civ = c("civilizacijų", "civilizacinių_aspiracijų",
          "kultūra_civilizacija", "civilizacinį_kultūrinį_kodą",
          "civilizaciniai_skirtumai", "civilizacinis_tapatumas",
          "civilizaciniu_požiūriu", "principai_ši_civilizacija",
          "civilizacinių_vertybių", "apgintų_civilizaciją",
          "europietiškajai_civilizacijai", "sergėti_civilizaciją",
          "vakarų_civilizacijos", "vakarų_civilizacijai",
          "vakarietiškos_civilizacijos", "vakarų_civilizacijoje",
          "grindžiamasvakarų_civilizacijos", "vakarų_civilizacija",
          "vakarų_krikščioniškoji_lotyniškoji_civilizacija", "vakarai_yra_civilizacija",
          "pasaulio_civilizacijos")))
lithuanian_multiword <- c("civilizacijų", "civilizacinių aspiracijų",
                          "kultūra civilizacija", "civilizacinį kultūrinį kodą",
                          "civilizaciniai skirtumai", "civilizacinis tapatumas",
                          "civilizaciniu požiūriu", "principai ši civilizacija",
                          "civilizacinių vertybių", "apgintų civilizaciją",
                          "europietiškajai civilizacijai", "sergėti civilizaciją",
                          "vakarų civilizacijos", "vakarų civilizacijai",
                          "vakarietiškos civilizacijos", "vakarų civilizacijoje",
                          "grindžiamasvakarų civilizacijos", "vakarų civilizacija",
                          "vakarų krikščioniškoji lotyniškoji civilizacija", "vakarai yra civilizacija",
                          "pasaulio civilizacijos")
dict_polish2 <- dictionary(list(
  civ = c("tożsamości cywilizacyjnej", "model cywilizacyjny",
          "cywilizacyjnej przestrzeni", "wartości cywilizacyjnych",
          "kontynentu i jego cywilizacji", "cywilizacyjnie europejczyków", 
          "cywilizacja europejska", "europejska tożsamość kulturowa i cywilizacyjna", 
          "narodotwórcza i cywilizacyjna", "naszej cywilizacji", 
          "cywilizacji zachodu", "zachodnia cywilizacja", 
          "zachodniej cywilizacji")))
polish_multiword <- c("tożsamości cywilizacyjnej", "model cywilizacyjny",
                      "cywilizacyjnej przestrzeni", "wartości cywilizacyjnych",
                      "kontynentu i jego cywilizacji", "cywilizacyjnie europejczyków", 
                      "cywilizacja europejska", "europejska tożsamość kulturowa i cywilizacyjna", 
                      "narodotwórcza i cywilizacyjna", "naszej cywilizacji", 
                      "cywilizacji zachodu", "zachodnia cywilizacja", 
                      "zachodniej cywilizacji")
dict_portuguese2 <- dictionary(list(
  civ = c("valores_culturais_e_civilizacionais", "área_civilizacional",
          "contactos_civilizacionais", "encontro_de_civilizações",
          "história_da_civilizaçao", "legado_civilizacional",
          "testemunho_civilizacional", "tradição_civilizacional",
          "valores_civilizacionais", "valores_e_referências_civilizacionais",
          "contributos_dados_por_portugal_para_a_civilização", "identidade_cultural_e_civilizacional",
          "matriz_cultural_e_civilizacional", "culturas_e_das_civilizações",
          "diálogo_entre_civilizações", "diálogo_entre_duas_civilizações",
          "civilizações_diferentes", "civilizações_distintas",
          "diversidade_das_civilizações", "conquista_civilizacional_europeia",
          "elo_entre_civilizações", "tradição_civilizacional_mediterrânica",
          "nações_e_das_civilizações", "património_social_e_civilizacional",
          "civilização_ocidental")))
portuguese_multiword <- c("valores culturais e civilizacionais", "área civilizacional",
                          "contactos civilizacionais", "encontro de civilizações",
                          "história da civilizaçao", "legado civilizacional",
                          "testemunho civilizacional", "tradição civilizacional",
                          "valores civilizacionais", "valores e referências civilizacionais",
                          "contributos dados por portugal para a civilização", "identidade cultural e civilizacional",
                          "matriz cultural e civilizacional", "culturas e das civilizações",
                          "diálogo entre civilizações", "diálogo entre duas civilizações",
                          "civilizações diferentes", "civilizações distintas",
                          "diversidade das civilizações", "conquista civilizacional europeia",
                          "elo entre civilizações", "tradição civilizacional mediterrânica",
                          "nações e das civilizações", "património social e civilizacional",
                          "civilização ocidental")
dict_romanian2 <- dictionary(list(
  civ = c("")))
dict_slovak2 <- dictionary(list(
  civ = c("kresťanskej_civilizácie", "civilizačný_okruh", 
          "civilizačného_okruhu", "civilizačné_návyky", 
          "európskej_civilizácie", "európska_civilizácia", 
          "európskych_civilizačných", "ľudskej_civilizácie", 
          "naša_civilizácia", "slovensko_civilizačne", 
          "slovákov_civilizačnou", "západnej_civilizácii", 
          "západnom_civilizačnom", "západná_civilizácia")))
slovak_multiword <- c("kresťanskej civilizácie", "civilizačný okruh", 
                      "civilizačného okruhu", "civilizačné návyky", 
                      "európskej civilizácie", "európska civilizácia", 
                      "európskych civilizačných", "ľudskej civilizácie", 
                      "naša civilizácia", "slovensko civilizačne", 
                      "slovákov civilizačnou", "západnej civilizácii", 
                      "západnom civilizačnom", "západná civilizácia")
dict_slovenian2 <- dictionary(list(
  civ = c("civilizacijami", "civilizacijski_dosežek", 
          "civilizacijskih_dosežkov", "civilizacijska_nasprotja", 
          "civilizacijski_in_kulturni", "kulturo_in_civilizacijo", 
          "kulture_in_civilizacije", "civilizacijske_podlage",
          "civilizacijski_temelji", "civilizacijsko_dediščino",
          "civilizacijsko_načelo", "civilizacijske_vrednote",
          "spopad_civilizacij", "kulturne_in_politične_civilizacije",
          "evropsko_civilizacijo", "evropske_kulture_civilizacije",
          "evropskih_kulturno-civilizacijskih", "evroameriške_civilizacije",
          "humano_civilizacijo", "človeška_civilizacija",
          "slovenska_civilizacijska", "zahodne_civilizacije")))
slovenian_multiword <- c("civilizacijami", "civilizacijski dosežek", 
                         "civilizacijskih dosežkov", "civilizacijska nasprotja", 
                         "civilizacijski in kulturni", "kulturo in civilizacijo", 
                         "kulture in civilizacije", "civilizacijske podlage",
                         "civilizacijski temelji", "civilizacijsko dediščino",
                         "civilizacijsko načelo", "civilizacijske vrednote",
                         "spopad civilizacij", "kulturne in politične civilizacije",
                         "evropsko civilizacijo", "evropske kulture civilizacije",
                         "evropskih kulturno-civilizacijskih", "evroameriške civilizacije",
                         "humano civilizacijo", "človeška civilizacija",
                         "slovenska civilizacijska", "zahodne civilizacije")
dict_spanish2 <- dictionary(list(
  civ = c("civilización_y_a_la_historia", "civilización_y_de_la_cultura",
          "nuestra_civilización")))
spanish_multiword <- c("civilización y a la historia", "civilización y de la cultura",
                       "nuestra civilización")
dict_swedish2 <- dictionary(list(
  civ = c("civilisation_från_barbari", "vår_civilisations")))
swedish_multiword <- c("civilisation från barbari", "vår civilisations")


# Text Preprocessing 2-----
# Belgium
belgium_dutch_tokens_comp <- tokens_compound(belgium_dutch_tokens, pattern = phrase(dutch_multiword))
belgium_dutch_dfm2 <- belgium_dutch_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
belgium_dutch2 <- belgium_dutch_dfm2 %>%
  dfm_lookup(dictionary = dict_dutch2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
belgium_dutch_ntoken2 <- as.data.frame(ntoken(belgium_dutch_dfm2)) %>%
  rename(n_2 = 'ntoken(belgium_dutch_dfm2)')
belgium_dutch_ntoken2$manifesto_id <- rownames(belgium_dutch_ntoken2)
belgium_dutch2 <- merge(belgium_dutch_ntoken2, belgium_dutch2,
                        by.x = "manifesto_id", by.y = "doc_id")
belgium_dutch2$civ <- 0
belgium_dutch2$civ[belgium_dutch2$civ_n > 0] <- 1
belgium_dutch2$civ <- as.factor(belgium_dutch2$civ)
belgium_dutch <- merge(belgium_dutch, belgium_dutch2, by = "manifesto_id")
belgium_dutch$civ_per <- belgium_dutch$civ_n/belgium_dutch$n

belgium_french_tokens_comp <- tokens_compound(belgium_french_tokens, pattern = phrase(french_multiword))
belgium_french_dfm2 <- belgium_french_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
belgium_french2 <- belgium_french_dfm2 %>%
  dfm_lookup(dictionary = dict_french2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
belgium_french_ntoken2 <- as.data.frame(ntoken(belgium_french_dfm2)) %>%
  rename(n_2 = 'ntoken(belgium_french_dfm2)')
belgium_french_ntoken2$manifesto_id <- rownames(belgium_french_ntoken2)
belgium_french2 <- merge(belgium_french_ntoken2, belgium_french2,
                         by.x = "manifesto_id", by.y = "doc_id")
belgium_french2$civ <- 0
belgium_french2$civ[belgium_french2$civ_n > 0] <- 1
belgium_french2$civ <- as.factor(belgium_french2$civ)
belgium_french <- merge(belgium_french, belgium_french2, by = "manifesto_id")
belgium_french$civ_per <- belgium_french$civ_n/belgium_french$n


# France
france_tokens_comp <- tokens_compound(france_tokens, pattern = phrase(french_multiword))
france_dfm2 <- france_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
france2 <- france_dfm2 %>%
  dfm_lookup(dictionary = dict_french2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
france_ntoken2 <- as.data.frame(ntoken(france_dfm2)) %>%
  rename(n_2 = 'ntoken(france_dfm2)')
france_ntoken2$manifesto_id <- rownames(france_ntoken2)
france2 <- merge(france_ntoken2, france2,
                 by.x = "manifesto_id", by.y = "doc_id")
france2$civ <- 0
france2$civ[france2$civ_n > 0] <- 1
france2$civ <- as.factor(france2$civ)
france <- merge(france, france2, by = "manifesto_id")
france$civ_per <- france$civ_n/france$n


# Germany
germany_tokens_comp <- tokens_compound(germany_tokens, pattern = phrase(german_multiword))
germany_dfm2 <- germany_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
germany2 <- germany_dfm2 %>%
  dfm_lookup(dictionary = dict_german2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
germany_ntoken2 <- as.data.frame(ntoken(germany_dfm2)) %>%
  rename(n_2 = 'ntoken(germany_dfm2)')
germany_ntoken2$manifesto_id <- rownames(germany_ntoken2)
germany2 <- merge(germany_ntoken2, germany2,
                  by.x = "manifesto_id", by.y = "doc_id")
germany2$civ <- 0
germany2$civ[germany2$civ_n > 0] <- 1
germany2$civ <- as.factor(germany2$civ)
germany <- merge(germany, germany2, by = "manifesto_id")
germany$civ_per <- germany$civ_n/germany$n


# Italy
italy_tokens_comp <- tokens_compound(italy_tokens, pattern = phrase(italian_multiword))
italy_dfm2 <- italy_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
italy2 <- italy_dfm2 %>%
  dfm_lookup(dictionary = dict_italian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
italy_ntoken2 <- as.data.frame(ntoken(italy_dfm2)) %>%
  rename(n_2 = 'ntoken(italy_dfm2)')
italy_ntoken2$manifesto_id <- rownames(italy_ntoken2)
italy2 <- merge(italy_ntoken2, italy2,
                by.x = "manifesto_id", by.y = "doc_id")
italy2$civ <- 0
italy2$civ[italy2$civ_n > 0] <- 1
italy2$civ <- as.factor(italy2$civ)
italy <- merge(italy, italy2, by = "manifesto_id")
italy$civ_per <- italy$civ_n/italy$n


# Luxembourg
luxembourg_french_tokens_comp <- tokens_compound(luxembourg_french_tokens, pattern = phrase(french_multiword))
luxembourg_french_dfm2 <- luxembourg_french_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
luxembourg_french2 <- luxembourg_french_dfm2 %>%
  dfm_lookup(dictionary = dict_french2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
luxembourg_french_ntoken2 <- as.data.frame(ntoken(luxembourg_french_dfm2)) %>%
  rename(n_2 = 'ntoken(luxembourg_french_dfm2)')
luxembourg_french_ntoken2$manifesto_id <- rownames(luxembourg_french_ntoken2)
luxembourg_french2 <- merge(luxembourg_french_ntoken2, luxembourg_french2,
                            by.x = "manifesto_id", by.y = "doc_id")
luxembourg_french2$civ <- 0
luxembourg_french2$civ[luxembourg_french2$civ_n > 0] <- 1
luxembourg_french2$civ <- as.factor(luxembourg_french2$civ)
luxembourg_french <- merge(luxembourg_french, luxembourg_french2, by = "manifesto_id")
luxembourg_french$civ_per <- luxembourg_french$civ_n/luxembourg_french$n

luxembourg_german_tokens_comp <- tokens_compound(luxembourg_german_tokens, pattern = phrase(german_multiword))
luxembourg_german_dfm2 <- luxembourg_german_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
luxembourg_german2 <- luxembourg_german_dfm2 %>%
  dfm_lookup(dictionary = dict_german2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
luxembourg_german_ntoken2 <- as.data.frame(ntoken(luxembourg_german_dfm2)) %>%
  rename(n_2 = 'ntoken(luxembourg_german_dfm2)')
luxembourg_german_ntoken2$manifesto_id <- rownames(luxembourg_german_ntoken2)
luxembourg_german2 <- merge(luxembourg_german_ntoken2, luxembourg_german2,
                            by.x = "manifesto_id", by.y = "doc_id")
luxembourg_german2$civ <- 0
luxembourg_german2$civ[luxembourg_german2$civ_n > 0] <- 1
luxembourg_german2$civ <- as.factor(luxembourg_german2$civ)
luxembourg_german <- merge(luxembourg_german, luxembourg_german2, by = "manifesto_id")
luxembourg_german$civ_per <- luxembourg_german$civ_n/luxembourg_german$n


# Netherlands
netherlands_tokens_comp <- tokens_compound(netherlands_tokens, pattern = phrase(dutch_multiword))
netherlands_dfm2 <- netherlands_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
netherlands2 <- netherlands_dfm2 %>%
  dfm_lookup(dictionary = dict_dutch2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
netherlands_ntoken2 <- as.data.frame(ntoken(netherlands_dfm2)) %>%
  rename(n_2 = 'ntoken(netherlands_dfm2)')
netherlands_ntoken2$manifesto_id <- rownames(netherlands_ntoken2)
netherlands2 <- merge(netherlands_ntoken2, netherlands2,
                      by.x = "manifesto_id", by.y = "doc_id")
netherlands2$civ <- 0
netherlands2$civ[netherlands2$civ_n > 0] <- 1
netherlands2$civ <- as.factor(netherlands2$civ)
netherlands <- merge(netherlands, netherlands2, by = "manifesto_id")
netherlands$civ_per <- netherlands$civ_n/netherlands$n

# Denmark
denmark_tokens_comp <- tokens_compound(denmark_tokens, pattern = phrase(danish_multiword))
denmark_dfm2 <- denmark_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
denmark2 <- denmark_dfm2 %>%
  dfm_lookup(dictionary = dict_danish2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
denmark_ntoken2 <- as.data.frame(ntoken(denmark_dfm2)) %>%
  rename(n_2 = 'ntoken(denmark_dfm2)')
denmark_ntoken2$manifesto_id <- rownames(denmark_ntoken2)
denmark2 <- merge(denmark_ntoken2, denmark2,
                  by.x = "manifesto_id", by.y = "doc_id")
denmark2$civ <- 0
denmark2$civ[denmark2$civ_n > 0] <- 1
denmark2$civ <- as.factor(denmark2$civ)
denmark <- merge(denmark, denmark2, by = "manifesto_id")
denmark$civ_per <- denmark$civ_n/denmark$n


# Ireland
ireland_tokens_comp <- tokens_compound(ireland_tokens, pattern = phrase(english_multiword))
ireland_dfm2 <- ireland_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
ireland2 <- ireland_dfm2 %>%
  dfm_lookup(dictionary = dict_english2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
ireland_ntoken2 <- as.data.frame(ntoken(ireland_dfm2)) %>%
  rename(n_2 = 'ntoken(ireland_dfm2)')
ireland_ntoken2$manifesto_id <- rownames(ireland_ntoken2)
ireland2 <- merge(ireland_ntoken2, ireland2,
                  by.x = "manifesto_id", by.y = "doc_id")
ireland2$civ <- 0
ireland2$civ[ireland2$civ_n > 0] <- 1
ireland2$civ <- as.factor(ireland2$civ)
ireland <- merge(ireland, ireland2, by = "manifesto_id")
ireland$civ_per <- ireland$civ_n/ireland$n


# UK
uk_tokens_comp <- tokens_compound(uk_tokens, pattern = phrase(english_multiword))
uk_dfm2 <- uk_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
uk2 <- uk_dfm2 %>%
  dfm_lookup(dictionary = dict_english2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
uk_ntoken2 <- as.data.frame(ntoken(uk_dfm2)) %>%
  rename(n_2 = 'ntoken(uk_dfm2)')
uk_ntoken2$manifesto_id <- rownames(uk_ntoken2)
uk2 <- merge(uk_ntoken2, uk2,
             by.x = "manifesto_id", by.y = "doc_id")
uk2$civ <- 0
uk2$civ[uk2$civ_n > 0] <- 1
uk2$civ <- as.factor(uk2$civ)
uk <- merge(uk, uk2, by = "manifesto_id")
uk$civ_per <- uk$civ_n/uk$n


# Greece
greece_tokens_comp <- tokens_compound(greece_tokens, pattern = phrase(greek_multiword))
greece_dfm2 <- greece_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
greece2 <- greece_dfm2 %>%
  dfm_lookup(dictionary = dict_greek2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
greece_ntoken2 <- as.data.frame(ntoken(greece_dfm2)) %>%
  rename(n_2 = 'ntoken(greece_dfm2)')
greece_ntoken2$manifesto_id <- rownames(greece_ntoken2)
greece2 <- merge(greece_ntoken2, greece2,
                 by.x = "manifesto_id", by.y = "doc_id")
greece2$civ <- 0
greece2$civ[greece2$civ_n > 0] <- 1
greece2$civ <- as.factor(greece2$civ)
greece <- merge(greece, greece2, by = "manifesto_id")
greece$civ_per <- greece$civ_n/greece$n


# Portugal
portugal_tokens_comp <- tokens_compound(portugal_tokens, pattern = phrase(portuguese_multiword))
portugal_dfm2 <- portugal_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
portugal2 <- portugal_dfm2 %>%
  dfm_lookup(dictionary = dict_portuguese2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
portugal_ntoken2 <- as.data.frame(ntoken(portugal_dfm2)) %>%
  rename(n_2 = 'ntoken(portugal_dfm2)')
portugal_ntoken2$manifesto_id <- rownames(portugal_ntoken2)
portugal2 <- merge(portugal_ntoken2, portugal2,
                   by.x = "manifesto_id", by.y = "doc_id")
portugal2$civ <- 0
portugal2$civ[portugal2$civ_n > 0] <- 1
portugal2$civ <- as.factor(portugal2$civ)
portugal <- merge(portugal, portugal2, by = "manifesto_id")
portugal$civ_per <- portugal$civ_n/portugal$n


# Spain
spain_tokens_comp <- tokens_compound(spain_tokens, pattern = phrase(spanish_multiword))
spain_dfm2 <- spain_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
spain2 <- spain_dfm2 %>%
  dfm_lookup(dictionary = dict_spanish2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
spain_ntoken2 <- as.data.frame(ntoken(spain_dfm2)) %>%
  rename(n_2 = 'ntoken(spain_dfm2)')
spain_ntoken2$manifesto_id <- rownames(spain_ntoken2)
spain2 <- merge(spain_ntoken2, spain2,
                by.x = "manifesto_id", by.y = "doc_id")
spain2$civ <- 0
spain2$civ[spain2$civ_n > 0] <- 1
spain2$civ <- as.factor(spain2$civ)
spain <- merge(spain, spain2, by = "manifesto_id")
spain$civ_per <- spain$civ_n/spain$n


# Austria
austria_tokens_comp <- tokens_compound(austria_tokens, pattern = phrase(german_multiword))
austria_dfm2 <- austria_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
austria2 <- austria_dfm2 %>%
  dfm_lookup(dictionary = dict_german2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
austria_ntoken2 <- as.data.frame(ntoken(austria_dfm2)) %>%
  rename(n_2 = 'ntoken(austria_dfm2)')
austria_ntoken2$manifesto_id <- rownames(austria_ntoken2)
austria2 <- merge(austria_ntoken2, austria2,
                  by.x = "manifesto_id", by.y = "doc_id")
austria2$civ <- 0
austria2$civ[austria2$civ_n > 0] <- 1
austria2$civ <- as.factor(austria2$civ)
austria <- merge(austria, austria2, by = "manifesto_id")
austria$civ_per <- austria$civ_n/austria$n


# Finland
finland_finnish$n_2 <- finland_finnish$n
finland_finnish$civ <- finland_finnish$civ_gen
finland_finnish$civ_n <- finland_finnish$civ_gen_n
finland_finnish$civ_per <- finland_finnish$civ_gen_per

finland_swedish$n_2 <- finland_swedish$n
finland_swedish$civ <- finland_swedish$civ_gen
finland_swedish$civ_n <- finland_swedish$civ_gen_n
finland_swedish$civ_per <- finland_swedish$civ_gen_per


# Sweden
sweden_tokens_comp <- tokens_compound(sweden_tokens, pattern = phrase(swedish_multiword))
sweden_dfm2 <- sweden_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
sweden2 <- sweden_dfm2 %>%
  dfm_lookup(dictionary = dict_swedish2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
sweden_ntoken2 <- as.data.frame(ntoken(sweden_dfm2)) %>%
  rename(n_2 = 'ntoken(sweden_dfm2)')
sweden_ntoken2$manifesto_id <- rownames(sweden_ntoken2)
sweden2 <- merge(sweden_ntoken2, sweden2,
                 by.x = "manifesto_id", by.y = "doc_id")
sweden2$civ <- 0
sweden2$civ[sweden2$civ_n > 0] <- 1
sweden2$civ <- as.factor(sweden2$civ)
sweden <- merge(sweden, sweden2, by = "manifesto_id")
sweden$civ_per <- sweden$civ_n/sweden$n


# Cyprus
cyprus_tokens_comp <- tokens_compound(cyprus_tokens, pattern = phrase(greek_multiword))
cyprus_dfm2 <- cyprus_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
cyprus2 <- cyprus_dfm2 %>%
  dfm_lookup(dictionary = dict_greek2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
cyprus_ntoken2 <- as.data.frame(ntoken(cyprus_dfm2)) %>%
  rename(n_2 = 'ntoken(cyprus_dfm2)')
cyprus_ntoken2$manifesto_id <- rownames(cyprus_ntoken2)
cyprus2 <- merge(cyprus_ntoken2, cyprus2,
                 by.x = "manifesto_id", by.y = "doc_id")
cyprus2$civ <- 0
cyprus2$civ[cyprus2$civ_n > 0] <- 1
cyprus2$civ <- as.factor(cyprus2$civ)
cyprus <- merge(cyprus, cyprus2, by = "manifesto_id")
cyprus$civ_per <- cyprus$civ_n/cyprus$n


# Czechia
czechia_tokens_comp <- tokens_compound(czechia_tokens, pattern = phrase(czech_multiword))
czechia_dfm2 <- czechia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
czechia2 <- czechia_dfm2 %>%
  dfm_lookup(dictionary = dict_czech2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
czechia_ntoken2 <- as.data.frame(ntoken(czechia_dfm2)) %>%
  rename(n_2 = 'ntoken(czechia_dfm2)')
czechia_ntoken2$manifesto_id <- rownames(czechia_ntoken2)
czechia2 <- merge(czechia_ntoken2, czechia2,
                  by.x = "manifesto_id", by.y = "doc_id")
czechia2$civ <- 0
czechia2$civ[czechia2$civ_n > 0] <- 1
czechia2$civ <- as.factor(czechia2$civ)
czechia <- merge(czechia, czechia2, by = "manifesto_id")
czechia$civ_per <- czechia$civ_n/czechia$n


# Estonia
estonia_tokens_comp <- tokens_compound(estonia_tokens, pattern = phrase(estonian_multiword))
estonia_dfm2 <- estonia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
estonia2 <- estonia_dfm2 %>%
  dfm_lookup(dictionary = dict_estonian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
estonia_ntoken2 <- as.data.frame(ntoken(estonia_dfm2)) %>%
  rename(n_2 = 'ntoken(estonia_dfm2)')
estonia_ntoken2$manifesto_id <- rownames(estonia_ntoken2)
estonia2 <- merge(estonia_ntoken2, estonia2,
                  by.x = "manifesto_id", by.y = "doc_id")
estonia2$civ <- 0
estonia2$civ[estonia2$civ_n > 0] <- 1
estonia2$civ <- as.factor(estonia2$civ)
estonia <- merge(estonia, estonia2, by = "manifesto_id")
estonia$civ_per <- estonia$civ_n/estonia$n


# Hungary
hungary_tokens_comp <- tokens_compound(hungary_tokens, pattern = phrase(hungarian_multiword))
hungary_dfm2 <- hungary_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
hungary2 <- hungary_dfm2 %>%
  dfm_lookup(dictionary = dict_hungarian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
hungary_ntoken2 <- as.data.frame(ntoken(hungary_dfm2)) %>%
  rename(n_2 = 'ntoken(hungary_dfm2)')
hungary_ntoken2$manifesto_id <- rownames(hungary_ntoken2)
hungary2 <- merge(hungary_ntoken2, hungary2,
                  by.x = "manifesto_id", by.y = "doc_id")
hungary2$civ <- 0
hungary2$civ[hungary2$civ_n > 0] <- 1
hungary2$civ <- as.factor(hungary2$civ)
hungary <- merge(hungary, hungary2, by = "manifesto_id")
hungary$civ_per <- hungary$civ_n/hungary$n


# Latvia
latvia_tokens_comp <- tokens_compound(latvia_tokens, pattern = phrase(latvian_multiword))
latvia_dfm2 <- latvia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
latvia2 <- latvia_dfm2 %>%
  dfm_lookup(dictionary = dict_latvian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
latvia_ntoken2 <- as.data.frame(ntoken(latvia_dfm2)) %>%
  rename(n_2 = 'ntoken(latvia_dfm2)')
latvia_ntoken2$manifesto_id <- rownames(latvia_ntoken2)
latvia2 <- merge(latvia_ntoken2, latvia2,
                 by.x = "manifesto_id", by.y = "doc_id")
latvia2$civ <- 0
latvia2$civ[latvia2$civ_n > 0] <- 1
latvia2$civ <- as.factor(latvia2$civ)
latvia <- merge(latvia, latvia2, by = "manifesto_id")
latvia$civ_per <- latvia$civ_n/latvia$n


# Lithuania
lithuania_tokens_comp <- tokens_compound(lithuania_tokens, pattern = phrase(lithuanian_multiword))
lithuania_dfm2 <- lithuania_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
lithuania2 <- lithuania_dfm2 %>%
  dfm_lookup(dictionary = dict_lithuanian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
lithuania_ntoken2 <- as.data.frame(ntoken(lithuania_dfm2)) %>%
  rename(n_2 = 'ntoken(lithuania_dfm2)')
lithuania_ntoken2$manifesto_id <- rownames(lithuania_ntoken2)
lithuania2 <- merge(lithuania_ntoken2, lithuania2,
                    by.x = "manifesto_id", by.y = "doc_id")
lithuania2$civ <- 0
lithuania2$civ[lithuania2$civ_n > 0] <- 1
lithuania2$civ <- as.factor(lithuania2$civ)
lithuania <- merge(lithuania, lithuania2, by = "manifesto_id")
lithuania$civ_per <- lithuania$civ_n/lithuania$n


# Poland
poland_tokens_comp <- tokens_compound(poland_tokens, pattern = phrase(polish_multiword))
poland_dfm2 <- poland_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
poland2 <- poland_dfm2 %>%
  dfm_lookup(dictionary = dict_polish2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
poland_ntoken2 <- as.data.frame(ntoken(poland_dfm2)) %>%
  rename(n_2 = 'ntoken(poland_dfm2)')
poland_ntoken2$manifesto_id <- rownames(poland_ntoken2)
poland2 <- merge(poland_ntoken2, poland2,
                 by.x = "manifesto_id", by.y = "doc_id")
poland2$civ <- 0
poland2$civ[poland2$civ_n > 0] <- 1
poland2$civ <- as.factor(poland2$civ)
poland <- merge(poland, poland2, by = "manifesto_id")
poland$civ_per <- poland$civ_n/poland$n


# Slovakia
slovakia_tokens_comp <- tokens_compound(slovakia_tokens, pattern = phrase(slovak_multiword))
slovakia_dfm2 <- slovakia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
slovakia2 <- slovakia_dfm2 %>%
  dfm_lookup(dictionary = dict_slovak2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
slovakia_ntoken2 <- as.data.frame(ntoken(slovakia_dfm2)) %>%
  rename(n_2 = 'ntoken(slovakia_dfm2)')
slovakia_ntoken2$manifesto_id <- rownames(slovakia_ntoken2)
slovakia2 <- merge(slovakia_ntoken2, slovakia2,
                   by.x = "manifesto_id", by.y = "doc_id")
slovakia2$civ <- 0
slovakia2$civ[slovakia2$civ_n > 0] <- 1
slovakia2$civ <- as.factor(slovakia2$civ)
slovakia <- merge(slovakia, slovakia2, by = "manifesto_id")
slovakia$civ_per <- slovakia$civ_n/slovakia$n


# Slovenia
slovenia_tokens_comp <- tokens_compound(slovenia_tokens, pattern = phrase(slovenian_multiword))
slovenia_dfm2 <- slovenia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
slovenia2 <- slovenia_dfm2 %>%
  dfm_lookup(dictionary = dict_slovenian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
slovenia_ntoken2 <- as.data.frame(ntoken(slovenia_dfm2)) %>%
  rename(n_2 = 'ntoken(slovenia_dfm2)')
slovenia_ntoken2$manifesto_id <- rownames(slovenia_ntoken2)
slovenia2 <- merge(slovenia_ntoken2, slovenia2,
                   by.x = "manifesto_id", by.y = "doc_id")
slovenia2$civ <- 0
slovenia2$civ[slovenia2$civ_n > 0] <- 1
slovenia2$civ <- as.factor(slovenia2$civ)
slovenia <- merge(slovenia, slovenia2, by = "manifesto_id")
slovenia$civ_per <- slovenia$civ_n/slovenia$n


# Romania
romania$civ <- as.factor(0)
romania$civ_n <- 0
romania$n_2 <- romania$n
romania$civ_per <- 0


# Bulgaria
bulgaria_tokens_comp <- tokens_compound(bulgaria_tokens, pattern = phrase(bulgarian_multiword))
bulgaria_dfm2 <- bulgaria_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
bulgaria2 <- bulgaria_dfm2 %>%
  dfm_lookup(dictionary = dict_bulgarian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
bulgaria_ntoken2 <- as.data.frame(ntoken(bulgaria_dfm2)) %>%
  rename(n_2 = 'ntoken(bulgaria_dfm2)')
bulgaria_ntoken2$manifesto_id <- rownames(bulgaria_ntoken2)
bulgaria2 <- merge(bulgaria_ntoken2, bulgaria2,
                   by.x = "manifesto_id", by.y = "doc_id")
bulgaria2$civ <- 0
bulgaria2$civ[bulgaria2$civ_n > 0] <- 1
bulgaria2$civ <- as.factor(bulgaria2$civ)
bulgaria <- merge(bulgaria, bulgaria2, by = "manifesto_id")
bulgaria$civ_per <- bulgaria$civ_n/bulgaria$n


# Croatia
croatia_tokens_comp <- tokens_compound(croatia_tokens, pattern = phrase(croatian_multiword))
croatia_dfm2 <- croatia_tokens_comp %>%
  dfm() %>%
  dfm_group(manifesto_id)
croatia2 <- croatia_dfm2 %>%
  dfm_lookup(dictionary = dict_croatian2) %>%
  convert(to = "data.frame") %>%
  rename(civ_n = civ)
croatia_ntoken2 <- as.data.frame(ntoken(croatia_dfm2)) %>%
  rename(n_2 = 'ntoken(croatia_dfm2)')
croatia_ntoken2$manifesto_id <- rownames(croatia_ntoken2)
croatia2 <- merge(croatia_ntoken2, croatia2,
                  by.x = "manifesto_id", by.y = "doc_id")
croatia2$civ <- 0
croatia2$civ[croatia2$civ_n > 0] <- 1
croatia2$civ <- as.factor(croatia2$civ)
croatia <- merge(croatia, croatia2, by = "manifesto_id")
croatia$civ_per <- croatia$civ_n/croatia$n


# Export Data-----
belgium <- rbind(belgium_dutch, belgium_french)
luxembourg <- rbind(luxembourg_french, luxembourg_german)
finland <- rbind(finland_finnish, finland_swedish)

data_all <- rbind(austria, belgium, bulgaria, croatia, cyprus,
                  czechia, denmark, estonia, finland, france,
                  germany, greece, hungary, ireland, italy, 
                  latvia, lithuania, luxembourg, netherlands, poland,
                  portugal, romania, slovakia, slovenia, spain,
                  sweden, uk)

data_all$parfam_cmp <- factor(data_all$parfam_cmp, 
                              levels = c("COM", "ECO", "SOC", "AGR",
                                         "LIB", "CHR", "CON", "NAT",
                                         "ETH", "SIP"))
data_all$party_family[data_all$parfam_cmp == "COM"] <- "Socialist"
data_all$party_family[data_all$parfam_cmp == "ECO"] <- "Ecological"
data_all$party_family[data_all$parfam_cmp == "SOC"] <- "Social Democratic"
data_all$party_family[data_all$parfam_cmp == "AGR"] <- "Agrarian"
data_all$party_family[data_all$parfam_cmp == "LIB"] <- "Liberal"
data_all$party_family[data_all$parfam_cmp == "CHR"] <- "Christian Democratic"
data_all$party_family[data_all$parfam_cmp == "CON"] <- "Conservative"
data_all$party_family[data_all$parfam_cmp == "NAT"] <- "Nationalist"
data_all$party_family[data_all$parfam_cmp == "ETH"] <- "Ethnic and Regional"
data_all$party_family[data_all$parfam_cmp == "SIP"] <- "Special Interest"
data_all$party_family <- factor(data_all$party_family,
                                levels = c("COM", "ECO", "SOC", "AGR",
                                           "LIB", "CHR", "CON", "NAT",
                                           "ETH", "SIP"))
data_all$civ_numeric[data_all$civ == "0"] <- 0
data_all$civ_numeric[data_all$civ == "1"] <- 1
data_all$civ_per <- data_all$civ_per * 100
data_all$state <- as.factor(data_all$state)
data_all$year_cat <- as.factor(data_all$year)

# Add your own File Path
write_rds(data_all, "~/FILE PATH/Manifestos.rds")

